<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.17"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>QuEST: QuEST.c Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
                    <a class="navbar-brand"><b>QuEST</b> v3.2.0<br>The Quantum Exact Simulation Toolkit</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_70834f0dcd10de01d2e35ab402a2238e.html">tysonjones</a></li><li class="navelem"><a class="el" href="dir_1957401ef452be7528010ba0f4832a45.html">Desktop</a></li><li class="navelem"><a class="el" href="dir_dee4414d5d72b49a9429e079789ffd08.html">GithubRepos</a></li><li class="navelem"><a class="el" href="dir_a89b43d59316bb5045aa22bb53a67d29.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_f1fe56bf5ef15ff22696c757278c6962.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_757750313c878cfe3b7d1ade55b4b819.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">QuEST.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="QuEST_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Distributed under MIT licence. See https://github.com/QuEST-Kit/QuEST/blob/master/LICENCE.txt for details</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST_8h.html">QuEST.h</a>&quot;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__precision_8h.html">QuEST_precision.h</a>&quot;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__internal_8h.html">QuEST_internal.h</a>&quot;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__validation_8h.html">QuEST_validation.h</a>&quot;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__qasm_8h.html">QuEST_qasm.h</a>&quot;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor"># include &lt;stdlib.h&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor"># include &lt;string.h&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    </div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment"> * state-vector management</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="group__type.html#ga3392816c0643414165c2f5caeec17df0">   36</a></span>&#160;<a class="code" href="structQureg.html">Qureg</a> <a class="code" href="group__type.html#ga3392816c0643414165c2f5caeec17df0">createQureg</a>(<span class="keywordtype">int</span> numQubits, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a45428d4a49b8798a8d25a7155f622238">validateNumQubitsInQureg</a>(numQubits, env.<a class="code" href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">numRanks</a>, __func__);</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <a class="code" href="structQureg.html">Qureg</a> qureg;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a365bbb1b80cb00405c8bf1a4fa1ea8e5">statevec_createQureg</a>(&amp;qureg, numQubits, env);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a> = 0;</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a> = numQubits;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    qureg.<a class="code" href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">numQubitsInStateVec</a> = numQubits;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa5f05644a6cea13e00f828658bcf7a68">qasm_setup</a>(&amp;qureg);</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <a class="code" href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a>(qureg); <span class="comment">// safe call to public function</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keywordflow">return</span> qureg;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;}</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="group__type.html#ga93e55b6650b408abb30a1d4a8bce757c">   50</a></span>&#160;<a class="code" href="structQureg.html">Qureg</a> <a class="code" href="group__type.html#ga93e55b6650b408abb30a1d4a8bce757c">createDensityQureg</a>(<span class="keywordtype">int</span> numQubits, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a45428d4a49b8798a8d25a7155f622238">validateNumQubitsInQureg</a>(2*numQubits, env.<a class="code" href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">numRanks</a>, __func__);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <a class="code" href="structQureg.html">Qureg</a> qureg;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a365bbb1b80cb00405c8bf1a4fa1ea8e5">statevec_createQureg</a>(&amp;qureg, 2*numQubits, env);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a> = 1;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a> = numQubits;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    qureg.<a class="code" href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">numQubitsInStateVec</a> = 2*numQubits;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    </div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa5f05644a6cea13e00f828658bcf7a68">qasm_setup</a>(&amp;qureg);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <a class="code" href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a>(qureg); <span class="comment">// safe call to public function</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keywordflow">return</span> qureg;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;}</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="group__type.html#gabd07eee133dcd4e6ae7c2d2ce4c42978">   64</a></span>&#160;<a class="code" href="structQureg.html">Qureg</a> <a class="code" href="group__type.html#gabd07eee133dcd4e6ae7c2d2ce4c42978">createCloneQureg</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <a class="code" href="structQureg.html">Qureg</a> newQureg;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a365bbb1b80cb00405c8bf1a4fa1ea8e5">statevec_createQureg</a>(&amp;newQureg, qureg.<a class="code" href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">numQubitsInStateVec</a>, env);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    newQureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a> = qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    newQureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a> = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    newQureg.<a class="code" href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">numQubitsInStateVec</a> = qureg.<a class="code" href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">numQubitsInStateVec</a>;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa5f05644a6cea13e00f828658bcf7a68">qasm_setup</a>(&amp;newQureg);</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa4b77089145184d990848cd66993aa8b">statevec_cloneQureg</a>(newQureg, qureg);</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keywordflow">return</span> newQureg;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;}</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="group__type.html#ga8e1e6ad3254892edc2ee08712ea9d692">   77</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#ga8e1e6ad3254892edc2ee08712ea9d692">destroyQureg</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a2a52ad9f9ad9b2fd6a76f6d433b3b217">statevec_destroyQureg</a>(qureg, env);</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae5ef90741274785eb1ebbbe828b7df8a">qasm_free</a>(qureg);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="comment"> * QASM</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="group__qasm.html#ga65bf1906298ca6355e2942f4923d77b6">   87</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__qasm.html#ga65bf1906298ca6355e2942f4923d77b6">startRecordingQASM</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a84b0328814c0b17e127396cb36065108">qasm_startRecording</a>(qureg);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;}</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="group__qasm.html#gabdaa339967f0955176a4967f01364182">   91</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__qasm.html#gabdaa339967f0955176a4967f01364182">stopRecordingQASM</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a77ad622c5ba852708a80755ac1792288">qasm_stopRecording</a>(qureg);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;}</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="group__qasm.html#gab3a410abab3e8beb394bd3bbfae8977c">   95</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__qasm.html#gab3a410abab3e8beb394bd3bbfae8977c">clearRecordedQASM</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#af2cdfa07be122a2c0b0e950ef45450bc">qasm_clearRecorded</a>(qureg);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;}</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="group__qasm.html#gacf139d0a54b1f9e5c2f2feff742b8c76">   99</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__qasm.html#gacf139d0a54b1f9e5c2f2feff742b8c76">printRecordedQASM</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9d97fdaec443ed238c1e72e387a688e3">qasm_printRecorded</a>(qureg);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;}</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160; </div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="group__qasm.html#ga0054955857ce83b88e127d731796c23d">  103</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__qasm.html#ga0054955857ce83b88e127d731796c23d">writeRecordedQASMToFile</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">char</span>* filename) {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keywordtype">int</span> success = <a class="code" href="QuEST__qasm_8c.html#a39aeacb22460bd1430129795761ade28">qasm_writeRecordedToFile</a>(qureg, filename);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6b9523909701f7bd79f2ab7b56a8e6bd">validateFileOpened</a>(success, filename, __func__);</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;}</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment"> * state initialisation</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">  113</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a2ca0c6ba07ab2b4b437321bf17efc966">statevec_initZeroState</a>(qureg); <span class="comment">// valid for both statevec and density matrices</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a4e21adca1f0ca03303bc2e57aaba4ce2">qasm_recordInitZero</a>(qureg);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;}</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="line" href="group__init.html#gada7230491a50cd409f8b00f5ee1db953">  119</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#gada7230491a50cd409f8b00f5ee1db953">initBlankState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a758bad4237ff0bf3b4ff5be626a982ae">statevec_initBlankState</a>(qureg);</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, the register was initialised to an unphysical all-zero-amplitudes &#39;state&#39;.&quot;</span>);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;}</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="group__init.html#ga234bd34016f08288532791903b9884b5">  125</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga234bd34016f08288532791903b9884b5">initPlusState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a2418bd9a6b9e6a0acf11faf5982d5d29">densmatr_initPlusState</a>(qureg);</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a482fc361fd5f08075404c72e536316a0">statevec_initPlusState</a>(qureg);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    </div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a627b0be7667c5a61a06b3b038fcc8b1b">qasm_recordInitPlus</a>(qureg);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;}</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="group__init.html#ga0379e21efca0767a22607fc0e26a5a22">  134</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga0379e21efca0767a22607fc0e26a5a22">initClassicalState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> stateInd) {</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a57dc69bb7a2217aafca676b0923d5e27">validateStateIndex</a>(qureg, stateInd, __func__);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a20a155f53efc45c16803d7539c2c199d">densmatr_initClassicalState</a>(qureg, stateInd);</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a288dc4b46bdacd69cbf4a6fd070d26a7">statevec_initClassicalState</a>(qureg, stateInd);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a55d0f243437a0bb3b7609a1090323aa3">qasm_recordInitClassical</a>(qureg, stateInd);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;}</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160; </div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="group__init.html#ga9a348df3e1df623c3d4c4f12c3ee3fe8">  145</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga9a348df3e1df623c3d4c4f12c3ee3fe8">initPureState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQureg.html">Qureg</a> pure) {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a7adc86571f1154558676d95daf0cbd1f">validateSecondQuregStateVec</a>(pure, __func__);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, pure, __func__);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160; </div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ae5ad68d054875913d0f7ec654840a9ec">densmatr_initPureState</a>(qureg, pure);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aa4b77089145184d990848cd66993aa8b">statevec_cloneQureg</a>(qureg, pure);</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    </div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, the register was initialised to an undisclosed given pure state.&quot;</span>);</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;}</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160; </div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="group__init.html#ga4589960486ec43dcd63bd985f1c4f398">  157</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga4589960486ec43dcd63bd985f1c4f398">initStateFromAmps</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* reals, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imags) {</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    </div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa121d55f2ca09c06a96ddcd433c60b0f">statevec_setAmps</a>(qureg, 0, reals, imags, qureg.<a class="code" href="structQureg.html#adef4935cac95763c29164cf99b144ed4">numAmpsTotal</a>);</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    </div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, the register was initialised to an undisclosed given pure state.&quot;</span>);</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;}</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160; </div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="group__init.html#ga4534403b721977b669bff7bf4e37f0fb">  165</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga4534403b721977b669bff7bf4e37f0fb">cloneQureg</a>(<a class="code" href="structQureg.html">Qureg</a> targetQureg, <a class="code" href="structQureg.html">Qureg</a> copyQureg) {</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(targetQureg, copyQureg, __func__);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(targetQureg, copyQureg, __func__);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    </div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa4b77089145184d990848cd66993aa8b">statevec_cloneQureg</a>(targetQureg, copyQureg);</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;}</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160; </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;<span class="comment"> * unitary gates</span></div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00177"></a><span class="lineno"><a class="line" href="group__unitary.html#ga6532decd6c404189915563492f090e6f">  177</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga6532decd6c404189915563492f090e6f">hadamard</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    </div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <a class="code" href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;        <a class="code" href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    }</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    </div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9">GATE_HADAMARD</a>, targetQubit);</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;}</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno"><a class="line" href="group__unitary.html#ga8886a3793b21622c48cf3bad6e15082d">  188</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga8886a3793b21622c48cf3bad6e15082d">rotateX</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    </div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <a class="code" href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    }</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a>, targetQubit, angle);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;}</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160; </div>
<div class="line"><a name="l00199"></a><span class="lineno"><a class="line" href="group__unitary.html#ga34312ff52cc28bcab3cbd2ff338fd081">  199</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga34312ff52cc28bcab3cbd2ff338fd081">rotateY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    </div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <a class="code" href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        <a class="code" href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, angle);</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    }</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    </div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a>, targetQubit, angle);</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;}</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno"><a class="line" href="group__unitary.html#gab23a8b022ec83b9d423961ca87cd8cb5">  210</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gab23a8b022ec83b9d423961ca87cd8cb5">rotateZ</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    </div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    }</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    </div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a>, targetQubit, angle);</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;}</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160; </div>
<div class="line"><a name="l00221"></a><span class="lineno"><a class="line" href="group__unitary.html#ga13f904b417f647c70d163770e65906fc">  221</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga13f904b417f647c70d163770e65906fc">controlledRotateX</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    <a class="code" href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;        <a class="code" href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a>(qureg, controlQubit+shift, targetQubit+shift, -angle);</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    }</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    </div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;}</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160; </div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="group__unitary.html#gafbbded98b7233f5da06d74d1db5cbfdb">  233</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gafbbded98b7233f5da06d74d1db5cbfdb">controlledRotateY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    </div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    <a class="code" href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <a class="code" href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a>(qureg, controlQubit+shift, targetQubit+shift, angle); <span class="comment">// rotateY is real</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;}</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="group__unitary.html#ga7eb969c1dd6c949aecf716d2fba71120">  245</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga7eb969c1dd6c949aecf716d2fba71120">controlledRotateZ</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    </div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <a class="code" href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a>(qureg, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        <a class="code" href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a>(qureg, controlQubit+shift, targetQubit+shift, -angle);</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    }</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    </div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a>, controlQubit, targetQubit, angle);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;}</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160; </div>
<div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="group__unitary.html#gab525a42d63233f61afeb6be97d89dd36">  257</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gab525a42d63233f61afeb6be97d89dd36">twoQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit1, <span class="keywordtype">int</span> targetQubit2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> u) {</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, (<span class="keywordtype">int</span> []) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    </div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <a class="code" href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a>(qureg, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        <a class="code" href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a>(qureg, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    }</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    </div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;}</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160; </div>
<div class="line"><a name="l00270"></a><span class="lineno"><a class="line" href="group__unitary.html#ga3d89916b46bc4aaf23e938022e6c89c1">  270</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga3d89916b46bc4aaf23e938022e6c89c1">controlledTwoQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit1, <span class="keywordtype">int</span> targetQubit2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> u) {</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, (<span class="keywordtype">int</span>[]) {controlQubit}, 1, (<span class="keywordtype">int</span>[]) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    </div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    <a class="code" href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a>(qureg, controlQubit, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;        <a class="code" href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a>(qureg, controlQubit+shift, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    }</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160; </div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed controlled 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;}</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160; </div>
<div class="line"><a name="l00283"></a><span class="lineno"><a class="line" href="group__unitary.html#ga65c7879947e398690a5428bd43e143e3">  283</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga65c7879947e398690a5428bd43e143e3">multiControlledTwoQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* controlQubits, <span class="keywordtype">int</span> numControlQubits, <span class="keywordtype">int</span> targetQubit1, <span class="keywordtype">int</span> targetQubit2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> u) {</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, controlQubits, numControlQubits, (<span class="keywordtype">int</span>[]) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a>(qureg, u, __func__);</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    </div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a>(qureg, ctrlQubitsMask, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, targetQubit1+shift, targetQubit2+shift, <a class="code" href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a>(u));</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    }</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;    </div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-controlled 2-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;}</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="line" href="group__unitary.html#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">  297</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">multiQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u) {</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targs, numTargs, __func__);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;    </div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    <a class="code" href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a>(qureg, targs, numTargs, u);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;        <a class="code" href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a>(qureg, targs, numTargs, u);</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;    }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    </div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;}</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160; </div>
<div class="line"><a name="l00314"></a><span class="lineno"><a class="line" href="group__unitary.html#gaeb975903209000ebbaf50ef1cc353a79">  314</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaeb975903209000ebbaf50ef1cc353a79">controlledMultiQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> ctrl, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u) {</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, (<span class="keywordtype">int</span>[]) {ctrl}, 1, targs, numTargs, __func__);</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    </div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    <a class="code" href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a>(qureg, ctrl, targs, numTargs, u);</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;        <a class="code" href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a>(qureg, ctrl+shift, targs, numTargs, u);</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    }</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed controlled multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;}</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160; </div>
<div class="line"><a name="l00331"></a><span class="lineno"><a class="line" href="group__unitary.html#ga3ad6c477edcdbc845fc1143e860fda08">  331</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga3ad6c477edcdbc845fc1143e860fda08">multiControlledMultiQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* ctrls, <span class="keywordtype">int</span> numCtrls, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u) {</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, ctrls, numCtrls, targs, numTargs, __func__);</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    </div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(ctrls, numCtrls);</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(qureg, ctrlMask, targs, numTargs, u);</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, shift);</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(qureg, ctrlMask&lt;&lt;shift, targs, numTargs, u);</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targs, numTargs, -shift);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        <a class="code" href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a>(u);</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    }</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    </div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed multi-controlled multi-qubit unitary was applied.&quot;</span>);</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;}</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160; </div>
<div class="line"><a name="l00349"></a><span class="lineno"><a class="line" href="group__unitary.html#ga78b814256f851cac70fdf3cbf9cfc206">  349</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga78b814256f851cac70fdf3cbf9cfc206">unitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) {</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;    </div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(qureg, targetQubit, u);</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    }</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    </div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ad22260712869e79f07d2f04e2b41a233">qasm_recordUnitary</a>(qureg, u, targetQubit);</div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;}</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160; </div>
<div class="line"><a name="l00361"></a><span class="lineno"><a class="line" href="group__unitary.html#gaa3fb996a5cadd098f4acd8aec955cf9c">  361</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaa3fb996a5cadd098f4acd8aec955cf9c">controlledUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) {</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    </div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    <a class="code" href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a>(qureg, controlQubit, targetQubit, u);</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        <a class="code" href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a>(qureg, controlQubit+shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    }</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;    </div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a5e99d405002cdf6ddd40922911d058a4">qasm_recordControlledUnitary</a>(qureg, u, controlQubit, targetQubit);</div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;}</div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160; </div>
<div class="line"><a name="l00374"></a><span class="lineno"><a class="line" href="group__unitary.html#gaa700dc9657ade4cf16f1cad1624c5332">  374</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaa700dc9657ade4cf16f1cad1624c5332">multiControlledUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* controlQubits, <span class="keywordtype">int</span> numControlQubits, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) {</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a>(qureg, controlQubits, numControlQubits, targetQubit, __func__);</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;    </div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlFlipMask = 0;</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask, ctrlFlipMask, targetQubit, u);</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, ctrlFlipMask&lt;&lt;shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;    }</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;    </div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a3a79e4305d35f1756b8438bbd34ea6cc">qasm_recordMultiControlledUnitary</a>(qureg, u, controlQubits, numControlQubits, targetQubit);</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;}</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160; </div>
<div class="line"><a name="l00389"></a><span class="lineno"><a class="line" href="group__unitary.html#ga41b946a82982c3fa3dc2a7395665bc90">  389</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga41b946a82982c3fa3dc2a7395665bc90">multiStateControlledUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* controlQubits, <span class="keywordtype">int</span>* controlState, <span class="keywordtype">int</span> numControlQubits, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) {</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a>(qureg, controlQubits, numControlQubits, targetQubit, __func__);</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a>(u, __func__);</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a0bd6443ea0f5e36738f3b39b72080b6e">validateControlState</a>(controlState, numControlQubits, __func__);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(controlQubits, numControlQubits);</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlFlipMask = <a class="code" href="QuEST__common_8c.html#a6fa6f1bc617e9fef3cd87ecc3677a02b">getControlFlipMask</a>(controlQubits, controlState, numControlQubits);</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask, ctrlFlipMask, targetQubit, u);</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(qureg, ctrlQubitsMask&lt;&lt;shift, ctrlFlipMask&lt;&lt;shift, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a>(u));</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    }</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;    </div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9975b6f54f4090cdf851958bc2b37230">qasm_recordMultiStateControlledUnitary</a>(qureg, u, controlQubits, controlState, numControlQubits, targetQubit);</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;}</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160; </div>
<div class="line"><a name="l00405"></a><span class="lineno"><a class="line" href="group__unitary.html#gaefaa7acba90373efe4e0f0b94987c734">  405</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaefaa7acba90373efe4e0f0b94987c734">compactUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplex.html">Complex</a> alpha, <a class="code" href="structComplex.html">Complex</a> beta) {</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a>(alpha, beta, __func__);</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;    </div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a>(qureg, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a>(qureg, targetQubit+shift, <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(alpha), <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(beta));</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    }</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160; </div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a518c4351d574aea8477019dbce02f09c">qasm_recordCompactUnitary</a>(qureg, alpha, beta, targetQubit);</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;}</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160; </div>
<div class="line"><a name="l00418"></a><span class="lineno"><a class="line" href="group__unitary.html#gaf7e15bf09c64082e0a8467998eb25623">  418</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaf7e15bf09c64082e0a8467998eb25623">controlledCompactUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplex.html">Complex</a> alpha, <a class="code" href="structComplex.html">Complex</a> beta) {</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a>(alpha, beta, __func__);</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;    </div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a>(qureg, controlQubit, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a>(qureg, </div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;            controlQubit+shift, targetQubit+shift, </div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;            <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(alpha), <a class="code" href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a>(beta));</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;    }</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;    </div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a6bd68fa9c0c1bd9c9f9af714ea0b8b03">qasm_recordControlledCompactUnitary</a>(qureg, alpha, beta, controlQubit, targetQubit);</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;}</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160; </div>
<div class="line"><a name="l00433"></a><span class="lineno"><a class="line" href="group__unitary.html#ga4193c14cfb918fa3291fb0648058d63e">  433</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga4193c14cfb918fa3291fb0648058d63e">pauliX</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;    </div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;    }</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;    </div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a>, targetQubit);</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;}</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160; </div>
<div class="line"><a name="l00444"></a><span class="lineno"><a class="line" href="group__unitary.html#ga8e0f03e745778a89d6f59c3c25e32df8">  444</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga8e0f03e745778a89d6f59c3c25e32df8">pauliY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;    </div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;    <a class="code" href="QuEST__internal_8h.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a>(qureg, targetQubit + qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;    }</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;    </div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a>, targetQubit);</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;}</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160; </div>
<div class="line"><a name="l00455"></a><span class="lineno"><a class="line" href="group__unitary.html#ga5d80b490e3910aa737a81bb597cdfcc9">  455</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga5d80b490e3910aa737a81bb597cdfcc9">pauliZ</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;    </div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;        <a class="code" href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;    }</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;    </div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, targetQubit);</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;}</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160; </div>
<div class="line"><a name="l00466"></a><span class="lineno"><a class="line" href="group__unitary.html#ga655ffcd4def2e127341c9488f5ca8455">  466</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga655ffcd4def2e127341c9488f5ca8455">sGate</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;    </div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;    <a class="code" href="QuEST__common_8c.html#a559d175d31cec552fc09aec3e8a78d11">statevec_sGate</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;        <a class="code" href="QuEST__common_8c.html#a142b424d903dfaca7a7ac166076f543a">statevec_sGateConj</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;    }</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;    </div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a">GATE_S</a>, targetQubit);</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;}</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160; </div>
<div class="line"><a name="l00477"></a><span class="lineno"><a class="line" href="group__unitary.html#gac15907193da5a7c48b9610a26e669064">  477</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gac15907193da5a7c48b9610a26e669064">tGate</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;    </div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2d96b4601cc3a9e1221e11a366fe1699">statevec_tGate</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;        <a class="code" href="QuEST__common_8c.html#a086fffa88b1aeec1405aa2dc41eab8a3">statevec_tGateConj</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;    }</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;    </div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f">GATE_T</a>, targetQubit);</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;}</div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160; </div>
<div class="line"><a name="l00488"></a><span class="lineno"><a class="line" href="group__unitary.html#ga26baa057f5db8804825c2d611386753b">  488</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga26baa057f5db8804825c2d611386753b">phaseShift</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;    </div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;    <a class="code" href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a>(qureg, targetQubit, angle);</div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;        <a class="code" href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a>(qureg, targetQubit+qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, -angle);</div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;    }</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;    </div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, targetQubit, angle);</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;}</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160; </div>
<div class="line"><a name="l00499"></a><span class="lineno"><a class="line" href="group__unitary.html#ga7214a79aa22ae7a50ad6f38615968cb0">  499</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga7214a79aa22ae7a50ad6f38615968cb0">controlledPhaseShift</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> idQubit1, <span class="keywordtype">int</span> idQubit2, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, idQubit1, idQubit2, __func__);</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;    </div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a>(qureg, idQubit1, idQubit2, angle);</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a>(qureg, idQubit1+shift, idQubit2+shift, -angle);</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;    }</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;    </div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, idQubit1, idQubit2, angle);</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;}</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160; </div>
<div class="line"><a name="l00511"></a><span class="lineno"><a class="line" href="group__unitary.html#ga0832e39058d913ad47af44e97a854446">  511</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga0832e39058d913ad47af44e97a854446">multiControlledPhaseShift</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> *controlQubits, <span class="keywordtype">int</span> numControlQubits, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a>(qureg, controlQubits, numControlQubits, __func__);</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;    </div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a>(qureg, controlQubits, numControlQubits, angle);</div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, shift);</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a>(qureg, controlQubits, numControlQubits, -angle);</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, -shift);</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;    }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;    </div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a1445a08d034806627cc0b5aa0f4f6d3a">qasm_recordMultiControlledParamGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a>, controlQubits, numControlQubits-1, controlQubits[numControlQubits-1], angle);</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;}</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160; </div>
<div class="line"><a name="l00525"></a><span class="lineno"><a class="line" href="group__unitary.html#gaa5a138473a4433c853c6e66e7aabc237">  525</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gaa5a138473a4433c853c6e66e7aabc237">controlledNot</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;    </div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;    <a class="code" href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a>(qureg, controlQubit, targetQubit);</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;        <a class="code" href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a>(qureg, controlQubit+shift, targetQubit+shift);</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;    }</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;    </div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a>, controlQubit, targetQubit);</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;}</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160; </div>
<div class="line"><a name="l00537"></a><span class="lineno"><a class="line" href="group__unitary.html#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">  537</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">controlledPauliY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit) {</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;    </div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a>(qureg, controlQubit, targetQubit);</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a>(qureg, controlQubit+shift, targetQubit+shift);</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;    }</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;    </div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a>, controlQubit, targetQubit);</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;}</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160; </div>
<div class="line"><a name="l00549"></a><span class="lineno"><a class="line" href="group__unitary.html#ga2fa310101ecffd6aeba96f77b7d85f56">  549</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga2fa310101ecffd6aeba96f77b7d85f56">controlledPhaseFlip</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> idQubit1, <span class="keywordtype">int</span> idQubit2) {</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, idQubit1, idQubit2, __func__);</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;    </div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a>(qureg, idQubit1, idQubit2);</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a>(qureg, idQubit1+shift, idQubit2+shift);</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;    }</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;    </div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, idQubit1, idQubit2);</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;}</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160; </div>
<div class="line"><a name="l00561"></a><span class="lineno"><a class="line" href="group__unitary.html#gad76781842af56821ed4e223bd776f057">  561</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#gad76781842af56821ed4e223bd776f057">multiControlledPhaseFlip</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> *controlQubits, <span class="keywordtype">int</span> numControlQubits) {</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a>(qureg, controlQubits, numControlQubits, __func__);</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;    </div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a>(qureg, controlQubits, numControlQubits);</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, shift);</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a>(qureg, controlQubits, numControlQubits);</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(controlQubits, numControlQubits, -shift);</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;    }</div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;    </div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#abecd71c919a35e5a87b07ba400edc7c2">qasm_recordMultiControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a>, controlQubits, numControlQubits-1, controlQubits[numControlQubits-1]);</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;}</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160; </div>
<div class="line"><a name="l00575"></a><span class="lineno"><a class="line" href="group__unitary.html#ga4c708f066b244801e10f538b48b90145">  575</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga4c708f066b244801e10f538b48b90145">rotateAroundAxis</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> rotQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle, <a class="code" href="structVector.html">Vector</a> axis) {</div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, rotQubit, __func__);</div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a>(axis, __func__);</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;    </div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;    <a class="code" href="QuEST__common_8c.html#adf5fbea75826cde7d86fd7c31bcf3dec">statevec_rotateAroundAxis</a>(qureg, rotQubit, angle, axis);</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2cbfe9f416d4d8acb56213841f62cb53">statevec_rotateAroundAxisConj</a>(qureg, rotQubit+shift, angle, axis);</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;    }</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;    </div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a42607270d63948acf84d6def787213e8">qasm_recordAxisRotation</a>(qureg, angle, axis, rotQubit);</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;}</div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160; </div>
<div class="line"><a name="l00588"></a><span class="lineno"><a class="line" href="group__unitary.html#ga0c84c429cb1d7e2596706c1804dd9cba">  588</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga0c84c429cb1d7e2596706c1804dd9cba">controlledRotateAroundAxis</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle, <a class="code" href="structVector.html">Vector</a> axis) {</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a>(qureg, controlQubit, targetQubit, __func__);</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a>(axis, __func__);</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;    </div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;    <a class="code" href="QuEST__common_8c.html#a336c3286d2434fc892ebe20e9fa22a24">statevec_controlledRotateAroundAxis</a>(qureg, controlQubit, targetQubit, angle, axis);</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        <a class="code" href="QuEST__common_8c.html#a5ea2384a9b33c94eac891aacbfa5da6a">statevec_controlledRotateAroundAxisConj</a>(qureg, controlQubit+shift, targetQubit+shift, angle, axis);</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    }</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;    </div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a33be8162c9633bb8015f06b38cf70735">qasm_recordControlledAxisRotation</a>(qureg, angle, axis, controlQubit, targetQubit);</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;}</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160; </div>
<div class="line"><a name="l00601"></a><span class="lineno"><a class="line" href="group__unitary.html#ga820fd139c035136819e371308c206e36">  601</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga820fd139c035136819e371308c206e36">swapGate</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qb1, <span class="keywordtype">int</span> qb2) {</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qb1, qb2, __func__);</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160; </div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a>(qureg, qb1, qb2);</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;        <a class="code" href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a>(qureg, qb1+shift, qb2+shift);</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;    }</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160; </div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78">GATE_SWAP</a>, qb1, qb2);</div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;}</div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160; </div>
<div class="line"><a name="l00613"></a><span class="lineno"><a class="line" href="group__unitary.html#ga75d5e65f87c68403602a669b9c6d52b0">  613</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga75d5e65f87c68403602a669b9c6d52b0">sqrtSwapGate</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qb1, <span class="keywordtype">int</span> qb2) {</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qb1, qb2, __func__);</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa28b7d9c0c3cf9c4be0e324fb9d6bf76">validateMultiQubitMatrixFitsInNode</a>(qureg, 2, __func__); <span class="comment">// uses 2qb unitary in QuEST_common</span></div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160; </div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;    <a class="code" href="QuEST__common_8c.html#a6550462400942be61b171c8840b36aa1">statevec_sqrtSwapGate</a>(qureg, qb1, qb2);</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;        <a class="code" href="QuEST__common_8c.html#a33cde9b6518d55a544eff20301a5d844">statevec_sqrtSwapGateConj</a>(qureg, qb1+shift, qb2+shift);</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;    }</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160; </div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a>(qureg, <a class="code" href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253">GATE_SQRT_SWAP</a>, qb1, qb2);</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;}</div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160; </div>
<div class="line"><a name="l00626"></a><span class="lineno"><a class="line" href="group__unitary.html#ga3250d0d95b5d755cad542a6a2372b894">  626</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga3250d0d95b5d755cad542a6a2372b894">multiRotateZ</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* qubits, <span class="keywordtype">int</span> numQubits, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, qubits, numQubits, __func__);</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;    </div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> mask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(qubits, numQubits);</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a>(qureg, mask, angle);</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a>(qureg, mask &lt;&lt; shift, -angle);</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;    }</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;    </div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;    <span class="comment">// @TODO: create actual QASM</span></div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;        <span class="stringliteral">&quot;Here a %d-qubit multiRotateZ of angle %g was performed (QASM not yet implemented)&quot;</span>,</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;        numQubits, angle);</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;}</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160; </div>
<div class="line"><a name="l00642"></a><span class="lineno"><a class="line" href="group__unitary.html#ga34aa4865c92f9aa5d898c91286c9eca5">  642</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__unitary.html#ga34aa4865c92f9aa5d898c91286c9eca5">multiRotatePauli</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* targetQubits, <span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>* targetPaulis, <span class="keywordtype">int</span> numTargets, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> angle) {</div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targetQubits, numTargets, __func__);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(targetPaulis, numTargets, __func__);</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;    </div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;    <span class="keywordtype">int</span> conj=0;</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a>(qureg, targetQubits, targetPaulis, numTargets, angle, conj);</div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;        conj = 1;</div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;        <span class="keywordtype">int</span> shift = qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targetQubits, numTargets, shift);</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;        <a class="code" href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a>(qureg, targetQubits, targetPaulis, numTargets, angle, conj);</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;        <a class="code" href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a>(targetQubits, numTargets, -shift);</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;    }</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;    </div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;    <span class="comment">// @TODO: create actual QASM</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;        <span class="stringliteral">&quot;Here a %d-qubit multiRotatePauli of angle %g was performed (QASM not yet implemented)&quot;</span>,</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;        numTargets, angle);</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;}</div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160; </div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160; </div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160; </div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;<span class="comment"> * register attributes</span></div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160; </div>
<div class="line"><a name="l00668"></a><span class="lineno"><a class="line" href="group__calc.html#ga73036c778d800703585ab3d8796a915f">  668</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group__calc.html#ga73036c778d800703585ab3d8796a915f">getNumQubits</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;    <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;}</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160; </div>
<div class="line"><a name="l00672"></a><span class="lineno"><a class="line" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df">  672</a></span>&#160;<span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df">getNumAmps</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;    </div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;    <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#adef4935cac95763c29164cf99b144ed4">numAmpsTotal</a>;</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;}</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160; </div>
<div class="line"><a name="l00678"></a><span class="lineno"><a class="line" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05">  678</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05">getRealAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index) {</div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;    </div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, index);</div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;}</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160; </div>
<div class="line"><a name="l00685"></a><span class="lineno"><a class="line" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a">  685</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a">getImagAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index) {</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;    </div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, index);</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;}</div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160; </div>
<div class="line"><a name="l00692"></a><span class="lineno"><a class="line" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">  692</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">getProbAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index) {</div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;    </div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#a3afe58e49dce5536bc4c1b7caddf44a6">statevec_getProbAmp</a>(qureg, index);</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;}</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160; </div>
<div class="line"><a name="l00699"></a><span class="lineno"><a class="line" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def">  699</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def">getAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index) {</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, index, __func__);</div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;    </div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;    <a class="code" href="structComplex.html">Complex</a> amp;</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;    amp.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, index);</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;    amp.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a> = <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, index);</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;    <span class="keywordflow">return</span> amp;</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;}</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160; </div>
<div class="line"><a name="l00709"></a><span class="lineno"><a class="line" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68">  709</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68">getDensityAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> row, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> col) {</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, row, __func__);</div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a>(qureg, col, __func__);</div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;    </div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> ind = row + col*(1LL &lt;&lt; qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;    <a class="code" href="structComplex.html">Complex</a> amp;</div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;    amp.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = <a class="code" href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(qureg, ind);</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;    amp.imag = <a class="code" href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(qureg, ind);</div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;    <span class="keywordflow">return</span> amp;</div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;}</div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160; </div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160; </div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;<span class="comment"> * non-unitary actions</span></div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160; </div>
<div class="line"><a name="l00726"></a><span class="lineno"><a class="line" href="group__normgate.html#ga34457f7f62ccd75fb7d3fe67cd2f815a">  726</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__normgate.html#ga34457f7f62ccd75fb7d3fe67cd2f815a">collapseToOutcome</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <span class="keywordtype">int</span> outcome) {</div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, measureQubit, __func__);</div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a>(outcome, __func__);</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;    </div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> outcomeProb;</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>) {</div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;        outcomeProb = <a class="code" href="QuEST__internal_8h.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;        <a class="code" href="QuEST__validation_8c.html#a8accabb8a9d573c2ff80305841c3053d">validateMeasurementProb</a>(outcomeProb, __func__);</div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a5658f2ecbbd4ea425db5f7dc7fc4ba92">densmatr_collapseToKnownProbOutcome</a>(qureg, measureQubit, outcome, outcomeProb);</div>
<div class="line"><a name="l00735"></a><span class="lineno">  735</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;        outcomeProb = <a class="code" href="QuEST__internal_8h.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;        <a class="code" href="QuEST__validation_8c.html#a8accabb8a9d573c2ff80305841c3053d">validateMeasurementProb</a>(outcomeProb, __func__);</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a008becc4a18f868340836e0ab9fd6df6">statevec_collapseToKnownProbOutcome</a>(qureg, measureQubit, outcome, outcomeProb);</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;    }</div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;    </div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a0befde437a58ef8fe38495bfc2a16f0e">qasm_recordMeasurement</a>(qureg, measureQubit);</div>
<div class="line"><a name="l00742"></a><span class="lineno">  742</span>&#160;    <span class="keywordflow">return</span> outcomeProb;</div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160;}</div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160; </div>
<div class="line"><a name="l00745"></a><span class="lineno"><a class="line" href="group__normgate.html#gae192ac0759e46c7b20a7182020155240">  745</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group__normgate.html#gae192ac0759e46c7b20a7182020155240">measureWithStats</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> *outcomeProb) {</div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, measureQubit, __func__);</div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160; </div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;    <span class="keywordtype">int</span> outcome;</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;        outcome = <a class="code" href="QuEST__common_8c.html#ae4ebc1f4dd48922bfb30ad1692310269">densmatr_measureWithStats</a>(qureg, measureQubit, outcomeProb);</div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;        outcome = <a class="code" href="QuEST__common_8c.html#ac2eb81c71d0e0fbec7be5b45b1db1448">statevec_measureWithStats</a>(qureg, measureQubit, outcomeProb);</div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;    </div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a0befde437a58ef8fe38495bfc2a16f0e">qasm_recordMeasurement</a>(qureg, measureQubit);</div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;    <span class="keywordflow">return</span> outcome;</div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160;}</div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160; </div>
<div class="line"><a name="l00758"></a><span class="lineno"><a class="line" href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656">  758</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656">measure</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit) {</div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, measureQubit, __func__);</div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;    </div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;    <span class="keywordtype">int</span> outcome;</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> discardedProb;</div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;        outcome = <a class="code" href="QuEST__common_8c.html#ae4ebc1f4dd48922bfb30ad1692310269">densmatr_measureWithStats</a>(qureg, measureQubit, &amp;discardedProb);</div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;        outcome = <a class="code" href="QuEST__common_8c.html#ac2eb81c71d0e0fbec7be5b45b1db1448">statevec_measureWithStats</a>(qureg, measureQubit, &amp;discardedProb);</div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;    </div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a0befde437a58ef8fe38495bfc2a16f0e">qasm_recordMeasurement</a>(qureg, measureQubit);</div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;    <span class="keywordflow">return</span> outcome;</div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;}</div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160; </div>
<div class="line"><a name="l00772"></a><span class="lineno"><a class="line" href="group__decoherence.html#ga97d563fa8f4bc51f720bbb653f5480b3">  772</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#ga97d563fa8f4bc51f720bbb653f5480b3">mixDensityMatrix</a>(<a class="code" href="structQureg.html">Qureg</a> combineQureg, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> otherProb, <a class="code" href="structQureg.html">Qureg</a> otherQureg) {</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(combineQureg, __func__);</div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(otherQureg, __func__);</div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(combineQureg, otherQureg, __func__);</div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ae06b0f6b669c03241d0db3b9dc560da1">validateProb</a>(otherProb, __func__);</div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160;    </div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a8adaba9dbdad6f7ab41ae4b8db0abefe">densmatr_mixDensityMatrix</a>(combineQureg, otherProb, otherQureg);</div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;}</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160; </div>
<div class="line"><a name="l00781"></a><span class="lineno"><a class="line" href="group__init.html#gabc0c64f8adf307d2a44184dc0f8ca66e">  781</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#gabc0c64f8adf307d2a44184dc0f8ca66e">setAmps</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> startInd, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* reals, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imags, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numAmps) {</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6904359f35d0b61b2c8fcecfac836033">validateNumAmps</a>(qureg, startInd, numAmps, __func__);</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;    </div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa121d55f2ca09c06a96ddcd433c60b0f">statevec_setAmps</a>(qureg, startInd, reals, imags, numAmps);</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;    </div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, some amplitudes in the statevector were manually edited.&quot;</span>);</div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;}</div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160; </div>
<div class="line"><a name="l00790"></a><span class="lineno"><a class="line" href="QuEST__debug_8h.html#ae85a2c07d2f1ff2265c4bf22e17653eb">  790</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST_8c.html#ae85a2c07d2f1ff2265c4bf22e17653eb">setDensityAmps</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* reals, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imags) {</div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numAmps = qureg.<a class="code" href="structQureg.html#adef4935cac95763c29164cf99b144ed4">numAmpsTotal</a>; </div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa121d55f2ca09c06a96ddcd433c60b0f">statevec_setAmps</a>(qureg, 0, reals, imags, numAmps);</div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;    </div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, some amplitudes in the density matrix were manually edited.&quot;</span>);</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;}</div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160; </div>
<div class="line"><a name="l00797"></a><span class="lineno"><a class="line" href="group__init.html#ga5d0f3f71ea38d3c44597f8c2c2f014d4">  797</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__init.html#ga5d0f3f71ea38d3c44597f8c2c2f014d4">setWeightedQureg</a>(<a class="code" href="structComplex.html">Complex</a> fac1, <a class="code" href="structQureg.html">Qureg</a> qureg1, <a class="code" href="structComplex.html">Complex</a> fac2, <a class="code" href="structQureg.html">Qureg</a> qureg2, <a class="code" href="structComplex.html">Complex</a> facOut, <a class="code" href="structQureg.html">Qureg</a> out) {</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg1, qureg2, __func__);</div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg1, out, __func__);</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg1, qureg2,  __func__);</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg1, out, __func__);</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160; </div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ad64a23933361fafc1b6b1787759c2663">statevec_setWeightedQureg</a>(fac1, qureg1, fac2, qureg2, facOut, out);</div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160; </div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(out, <span class="stringliteral">&quot;Here, the register was modified to an undisclosed and possibly unphysical state (setWeightedQureg).&quot;</span>);</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;} </div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160; </div>
<div class="line"><a name="l00808"></a><span class="lineno"><a class="line" href="group__operator.html#ga6fc26cf857db070e12959e59ecfed8a6">  808</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#ga6fc26cf857db070e12959e59ecfed8a6">applyPauliSum</a>(<a class="code" href="structQureg.html">Qureg</a> inQureg, <span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>* allPauliCodes, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* termCoeffs, <span class="keywordtype">int</span> numSumTerms, <a class="code" href="structQureg.html">Qureg</a> outQureg) {</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(inQureg, outQureg, __func__);</div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(inQureg, outQureg, __func__);</div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5be128290a7bba9a7f12d32cabe2276b">validateNumPauliSumTerms</a>(numSumTerms, __func__);</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(allPauliCodes, numSumTerms*inQureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, __func__);</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;    </div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;    <a class="code" href="QuEST__common_8c.html#af71c2470694795a8d639be8ff9c34ed5">statevec_applyPauliSum</a>(inQureg, allPauliCodes, termCoeffs, numSumTerms, outQureg);</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;    </div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(outQureg, <span class="stringliteral">&quot;Here, the register was modified to an undisclosed and possibly unphysical state (applyPauliSum).&quot;</span>);</div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;}</div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160; </div>
<div class="line"><a name="l00819"></a><span class="lineno"><a class="line" href="group__operator.html#ga54d4e589468002bdc998200ae45e7312">  819</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#ga54d4e589468002bdc998200ae45e7312">applyPauliHamil</a>(<a class="code" href="structQureg.html">Qureg</a> inQureg, <a class="code" href="structPauliHamil.html">PauliHamil</a> hamil, <a class="code" href="structQureg.html">Qureg</a> outQureg) {</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(inQureg, outQureg, __func__);</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(inQureg, outQureg, __func__);</div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a>(hamil, __func__);</div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a>(inQureg, hamil, __func__);</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160;    </div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;    <a class="code" href="QuEST__common_8c.html#af71c2470694795a8d639be8ff9c34ed5">statevec_applyPauliSum</a>(inQureg, hamil.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>, hamil.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>, hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>, outQureg);</div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;    </div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(outQureg, <span class="stringliteral">&quot;Here, the register was modified to an undisclosed and possibly unphysical state (applyPauliHamil).&quot;</span>);</div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;}</div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160; </div>
<div class="line"><a name="l00830"></a><span class="lineno"><a class="line" href="group__operator.html#ga35b6321c578a8c69470132b5ee95f930">  830</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#ga35b6321c578a8c69470132b5ee95f930">applyTrotterCircuit</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structPauliHamil.html">PauliHamil</a> hamil, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> time, <span class="keywordtype">int</span> order, <span class="keywordtype">int</span> reps) {</div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a82b142fe77ba20c87142274f32e57689">validateTrotterParams</a>(order, reps, __func__);</div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a>(hamil, __func__);</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a>(qureg, hamil, __func__);</div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;    </div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;        <span class="stringliteral">&quot;Beginning of Trotter circuit (time %g, order %d, %d repetitions).&quot;</span>,</div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160;        time, order, reps);</div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160;        </div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;    <a class="code" href="QuEST__common_8c.html#a8a8e789585651f90fcc587042d4cdfb8">agnostic_applyTrotterCircuit</a>(qureg, hamil, time, order, reps);</div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160; </div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;End of Trotter circuit&quot;</span>);</div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;}</div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160; </div>
<div class="line"><a name="l00844"></a><span class="lineno"><a class="line" href="group__operator.html#gadfb5c1d99a22ce666fc715a8da2e0950">  844</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#gadfb5c1d99a22ce666fc715a8da2e0950">applyMatrix2</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) {</div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160;    </div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;    <span class="comment">// actually just left-multiplies any complex matrix</span></div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(qureg, targetQubit, u);</div>
<div class="line"><a name="l00849"></a><span class="lineno">  849</span>&#160; </div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed 2-by-2 matrix (possibly non-unitary) was multiplied onto qubit %d&quot;</span>, targetQubit);</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;}</div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160; </div>
<div class="line"><a name="l00853"></a><span class="lineno"><a class="line" href="group__operator.html#ga74a955ec4bce606d89317bcfc528387f">  853</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#ga74a955ec4bce606d89317bcfc528387f">applyMatrix4</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit1, <span class="keywordtype">int</span> targetQubit2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> u) {</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, (<span class="keywordtype">int</span> []) {targetQubit1, targetQubit2}, 2, __func__);</div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa28b7d9c0c3cf9c4be0e324fb9d6bf76">validateMultiQubitMatrixFitsInNode</a>(qureg, 2, __func__);</div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160;    </div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;    <span class="comment">// actually just left-multiplies any complex matrix</span></div>
<div class="line"><a name="l00858"></a><span class="lineno">  858</span>&#160;    <a class="code" href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a>(qureg, targetQubit1, targetQubit2, u);</div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160; </div>
<div class="line"><a name="l00860"></a><span class="lineno">  860</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed 4-by-4 matrix (possibly non-unitary) was multiplied onto qubits %d and %d&quot;</span>, targetQubit1, targetQubit2);</div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;}</div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160; </div>
<div class="line"><a name="l00863"></a><span class="lineno"><a class="line" href="group__operator.html#ga358e7094a98851afa86d27f0147e32a1">  863</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#ga358e7094a98851afa86d27f0147e32a1">applyMatrixN</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u) {</div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targs, numTargs, __func__);</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a576519ac36b7cb25bab78d05b5d1975f">validateMultiQubitMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;    </div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;    <span class="comment">// actually just left-multiplies any complex matrix</span></div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;    <a class="code" href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a>(qureg, targs, numTargs, u);</div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;    </div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;    <span class="keywordtype">int</span> dim = (1 &lt;&lt; numTargs);</div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed %d-by-%d matrix (possibly non-unitary) was multiplied onto %d undisclosed qubits&quot;</span>, dim, dim, numTargs);</div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;}</div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160; </div>
<div class="line"><a name="l00874"></a><span class="lineno"><a class="line" href="group__operator.html#gab52b6315c5520b7d311b0458785eed8e">  874</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#gab52b6315c5520b7d311b0458785eed8e">applyMultiControlledMatrixN</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* ctrls, <span class="keywordtype">int</span> numCtrls, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u) {</div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a>(qureg, ctrls, numCtrls, targs, numTargs, __func__);</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a576519ac36b7cb25bab78d05b5d1975f">validateMultiQubitMatrix</a>(qureg, u, numTargs, __func__);</div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;    </div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;    <span class="comment">// actually just left-multiplies any complex matrix</span></div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlMask = <a class="code" href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a>(ctrls, numCtrls);</div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(qureg, ctrlMask, targs, numTargs, u);</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;    </div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;    <span class="keywordtype">int</span> numTot = numTargs + numCtrls;</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;    <span class="keywordtype">int</span> dim = (1 &lt;&lt; numTot );</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, an undisclosed %d-by-%d matrix (possibly non-unitary, and including %d controlled qubits) was multiplied onto %d undisclosed qubits&quot;</span>, dim, dim, numCtrls, numTot);</div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;}</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160; </div>
<div class="line"><a name="l00887"></a><span class="lineno"><a class="line" href="group__operator.html#gad2e953390342cd361cfb4064d47715e6">  887</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__operator.html#gad2e953390342cd361cfb4064d47715e6">applyDiagonalOp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a8a656a83bf0b44447188d06c2f8114cb">validateDiagonalOp</a>(qureg, op, __func__);</div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160; </div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;        <a class="code" href="QuEST__internal_8h.html#aedd7ecccf2f09dd2f1c5d191950b51e6">densmatr_applyDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;        <a class="code" href="QuEST__internal_8h.html#a27294e3065ebe42a65b3b9e0f85551dd">statevec_applyDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160; </div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, <span class="stringliteral">&quot;Here, the register was modified to an undisclosed and possibly unphysical state (via applyDiagonalOp).&quot;</span>);</div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;}</div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160; </div>
<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160; </div>
<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;<span class="comment"> * calculations</span></div>
<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160; </div>
<div class="line"><a name="l00903"></a><span class="lineno"><a class="line" href="group__calc.html#gab082910d33473ec29e1d5852943de468">  903</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#gab082910d33473ec29e1d5852943de468">calcTotalProb</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)  </div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a>(qureg);</div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;        <span class="keywordflow">else</span></div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a>(qureg);</div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;}</div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160; </div>
<div class="line"><a name="l00910"></a><span class="lineno"><a class="line" href="group__calc.html#ga374ad70804998394ae41ebfe106258a6">  910</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="group__calc.html#ga374ad70804998394ae41ebfe106258a6">calcInnerProduct</a>(<a class="code" href="structQureg.html">Qureg</a> bra, <a class="code" href="structQureg.html">Qureg</a> ket) {</div>
<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(bra, __func__);</div>
<div class="line"><a name="l00912"></a><span class="lineno">  912</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(ket, __func__);</div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(bra, ket,  __func__);</div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;    </div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a>(bra, ket);</div>
<div class="line"><a name="l00916"></a><span class="lineno">  916</span>&#160;}</div>
<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160; </div>
<div class="line"><a name="l00918"></a><span class="lineno"><a class="line" href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22">  918</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22">calcDensityInnerProduct</a>(<a class="code" href="structQureg.html">Qureg</a> rho1, <a class="code" href="structQureg.html">Qureg</a> rho2) {</div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(rho1, __func__);</div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(rho2, __func__);</div>
<div class="line"><a name="l00921"></a><span class="lineno">  921</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(rho1, rho2, __func__);</div>
<div class="line"><a name="l00922"></a><span class="lineno">  922</span>&#160;    </div>
<div class="line"><a name="l00923"></a><span class="lineno">  923</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a>(rho1, rho2);</div>
<div class="line"><a name="l00924"></a><span class="lineno">  924</span>&#160;}</div>
<div class="line"><a name="l00925"></a><span class="lineno">  925</span>&#160; </div>
<div class="line"><a name="l00926"></a><span class="lineno"><a class="line" href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad">  926</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad">calcProbOfOutcome</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <span class="keywordtype">int</span> outcome) {</div>
<div class="line"><a name="l00927"></a><span class="lineno">  927</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, measureQubit, __func__);</div>
<div class="line"><a name="l00928"></a><span class="lineno">  928</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a>(outcome, __func__);</div>
<div class="line"><a name="l00929"></a><span class="lineno">  929</span>&#160;    </div>
<div class="line"><a name="l00930"></a><span class="lineno">  930</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00931"></a><span class="lineno">  931</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l00932"></a><span class="lineno">  932</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00933"></a><span class="lineno">  933</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a>(qureg, measureQubit, outcome);</div>
<div class="line"><a name="l00934"></a><span class="lineno">  934</span>&#160;}</div>
<div class="line"><a name="l00935"></a><span class="lineno">  935</span>&#160; </div>
<div class="line"><a name="l00936"></a><span class="lineno"><a class="line" href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede">  936</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede">calcPurity</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;    </div>
<div class="line"><a name="l00939"></a><span class="lineno">  939</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a>(qureg);</div>
<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;}</div>
<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160; </div>
<div class="line"><a name="l00942"></a><span class="lineno"><a class="line" href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc">  942</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc">calcFidelity</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQureg.html">Qureg</a> pureState) {</div>
<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a7adc86571f1154558676d95daf0cbd1f">validateSecondQuregStateVec</a>(pureState, __func__);</div>
<div class="line"><a name="l00944"></a><span class="lineno">  944</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, pureState, __func__);</div>
<div class="line"><a name="l00945"></a><span class="lineno">  945</span>&#160;    </div>
<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a>(qureg, pureState);</div>
<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00949"></a><span class="lineno">  949</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#aeeec9fe1501e25930adf6c38763a158e">statevec_calcFidelity</a>(qureg, pureState);</div>
<div class="line"><a name="l00950"></a><span class="lineno">  950</span>&#160;}</div>
<div class="line"><a name="l00951"></a><span class="lineno">  951</span>&#160; </div>
<div class="line"><a name="l00952"></a><span class="lineno"><a class="line" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">  952</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">calcExpecPauliProd</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* targetQubits, <span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>* pauliCodes, <span class="keywordtype">int</span> numTargets, <a class="code" href="structQureg.html">Qureg</a> workspace) {</div>
<div class="line"><a name="l00953"></a><span class="lineno">  953</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targetQubits, numTargets, __func__);</div>
<div class="line"><a name="l00954"></a><span class="lineno">  954</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(pauliCodes, numTargets, __func__);</div>
<div class="line"><a name="l00955"></a><span class="lineno">  955</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00956"></a><span class="lineno">  956</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00957"></a><span class="lineno">  957</span>&#160;    </div>
<div class="line"><a name="l00958"></a><span class="lineno">  958</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#aef380928d1b0003411d6159ca6594cd5">statevec_calcExpecPauliProd</a>(qureg, targetQubits, pauliCodes, numTargets, workspace);</div>
<div class="line"><a name="l00959"></a><span class="lineno">  959</span>&#160;}</div>
<div class="line"><a name="l00960"></a><span class="lineno">  960</span>&#160; </div>
<div class="line"><a name="l00961"></a><span class="lineno"><a class="line" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">  961</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">calcExpecPauliSum</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>* allPauliCodes, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* termCoeffs, <span class="keywordtype">int</span> numSumTerms, <a class="code" href="structQureg.html">Qureg</a> workspace) {</div>
<div class="line"><a name="l00962"></a><span class="lineno">  962</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a5be128290a7bba9a7f12d32cabe2276b">validateNumPauliSumTerms</a>(numSumTerms, __func__);</div>
<div class="line"><a name="l00963"></a><span class="lineno">  963</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(allPauliCodes, numSumTerms*qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>, __func__);</div>
<div class="line"><a name="l00964"></a><span class="lineno">  964</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00965"></a><span class="lineno">  965</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00966"></a><span class="lineno">  966</span>&#160;    </div>
<div class="line"><a name="l00967"></a><span class="lineno">  967</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a>(qureg, allPauliCodes, termCoeffs, numSumTerms, workspace);</div>
<div class="line"><a name="l00968"></a><span class="lineno">  968</span>&#160;}</div>
<div class="line"><a name="l00969"></a><span class="lineno">  969</span>&#160; </div>
<div class="line"><a name="l00970"></a><span class="lineno"><a class="line" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f">  970</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga5544d2833a69941b8820797b79daf79f">calcExpecPauliHamil</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structPauliHamil.html">PauliHamil</a> hamil, <a class="code" href="structQureg.html">Qureg</a> workspace) {</div>
<div class="line"><a name="l00971"></a><span class="lineno">  971</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00972"></a><span class="lineno">  972</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg, workspace, __func__);</div>
<div class="line"><a name="l00973"></a><span class="lineno">  973</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a>(hamil, __func__);</div>
<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a>(qureg, hamil, __func__);</div>
<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;    </div>
<div class="line"><a name="l00976"></a><span class="lineno">  976</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a>(qureg, hamil.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>, hamil.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>, hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>, workspace);</div>
<div class="line"><a name="l00977"></a><span class="lineno">  977</span>&#160;}</div>
<div class="line"><a name="l00978"></a><span class="lineno">  978</span>&#160; </div>
<div class="line"><a name="l00979"></a><span class="lineno"><a class="line" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810">  979</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810">calcExpecDiagonalOp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l00980"></a><span class="lineno">  980</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a8a656a83bf0b44447188d06c2f8114cb">validateDiagonalOp</a>(qureg, op, __func__);</div>
<div class="line"><a name="l00981"></a><span class="lineno">  981</span>&#160;    </div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;    <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">isDensityMatrix</a>)</div>
<div class="line"><a name="l00983"></a><span class="lineno">  983</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l00984"></a><span class="lineno">  984</span>&#160;    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a>(qureg, op);</div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;}</div>
<div class="line"><a name="l00987"></a><span class="lineno">  987</span>&#160; </div>
<div class="line"><a name="l00988"></a><span class="lineno"><a class="line" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387">  988</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387">calcHilbertSchmidtDistance</a>(<a class="code" href="structQureg.html">Qureg</a> a, <a class="code" href="structQureg.html">Qureg</a> b) {</div>
<div class="line"><a name="l00989"></a><span class="lineno">  989</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(a, __func__);</div>
<div class="line"><a name="l00990"></a><span class="lineno">  990</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(b, __func__);</div>
<div class="line"><a name="l00991"></a><span class="lineno">  991</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(a, b, __func__);</div>
<div class="line"><a name="l00992"></a><span class="lineno">  992</span>&#160;    </div>
<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a>(a, b);</div>
<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;}</div>
<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160; </div>
<div class="line"><a name="l00996"></a><span class="lineno">  996</span>&#160; </div>
<div class="line"><a name="l00997"></a><span class="lineno">  997</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00998"></a><span class="lineno">  998</span>&#160;<span class="comment"> * decoherence</span></div>
<div class="line"><a name="l00999"></a><span class="lineno">  999</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>&#160; </div>
<div class="line"><a name="l01001"></a><span class="lineno"><a class="line" href="group__decoherence.html#gacc2667ac87482a7afdcb711b74bf732e"> 1001</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#gacc2667ac87482a7afdcb711b74bf732e">mixDephasing</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob) {</div>
<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aef4d89ae4b8a8b4f414ebd03ef4c6acf">validateOneQubitDephaseProb</a>(prob, __func__);</div>
<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>&#160;    </div>
<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>&#160;    <a class="code" href="QuEST__internal_8h.html#aa31f0ef43a921c3ac73545d1d3670fa1">densmatr_mixDephasing</a>(qureg, targetQubit, 2*prob);</div>
<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>&#160;        <span class="stringliteral">&quot;Here, a phase (Z) error occured on qubit %d with probability %g&quot;</span>, targetQubit, prob);</div>
<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>&#160;}</div>
<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>&#160; </div>
<div class="line"><a name="l01011"></a><span class="lineno"><a class="line" href="group__decoherence.html#ga14282bdb1dc65760ca9ecbe6305eb770"> 1011</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#ga14282bdb1dc65760ca9ecbe6305eb770">mixTwoQubitDephasing</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qubit1, <span class="keywordtype">int</span> qubit2, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob) {</div>
<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qubit1, qubit2, __func__);</div>
<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a2f58e35b04edfbc053e0c9ae19f1be97">validateTwoQubitDephaseProb</a>(prob, __func__);</div>
<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>&#160; </div>
<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>&#160;    <a class="code" href="QuEST__common_8c.html#ac8ea84dd85eca525daeeb30b3c96b673">ensureIndsIncrease</a>(&amp;qubit1, &amp;qubit2);</div>
<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a623e577b7230f3c8dc202be6185b4289">densmatr_mixTwoQubitDephasing</a>(qureg, qubit1, qubit2, (4*prob)/3.0);</div>
<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg,</div>
<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>&#160;        <span class="stringliteral">&quot;Here, a phase (Z) error occured on either or both of qubits &quot;</span></div>
<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>&#160;        <span class="stringliteral">&quot;%d and %d with total probability %g&quot;</span>, qubit1, qubit2, prob);</div>
<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>&#160;}</div>
<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>&#160; </div>
<div class="line"><a name="l01023"></a><span class="lineno"><a class="line" href="group__decoherence.html#gae2ea9255b8b11a4a382231e5604dc4e3"> 1023</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#gae2ea9255b8b11a4a382231e5604dc4e3">mixDepolarising</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob) {</div>
<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a269b2f7ee5c4376ae633cd2b77a7be38">validateOneQubitDepolProb</a>(prob, __func__);</div>
<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>&#160;    </div>
<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a398b60c4cb4fa2cf2ffc126de6c08da0">densmatr_mixDepolarising</a>(qureg, targetQubit, (4*prob)/3.0);</div>
<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg,</div>
<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>&#160;        <span class="stringliteral">&quot;Here, a homogeneous depolarising error (X, Y, or Z) occured on &quot;</span></div>
<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>&#160;        <span class="stringliteral">&quot;qubit %d with total probability %g&quot;</span>, targetQubit, prob);</div>
<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>&#160;}</div>
<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>&#160; </div>
<div class="line"><a name="l01034"></a><span class="lineno"><a class="line" href="group__decoherence.html#gaea8509011985522bae857bd3b13c34ed"> 1034</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#gaea8509011985522bae857bd3b13c34ed">mixDamping</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob) {</div>
<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, targetQubit, __func__);</div>
<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a260639d187d09cbeef3ff36f0d4d1f0e">validateOneQubitDampingProb</a>(prob, __func__);</div>
<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;    </div>
<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ac501fe7b9d331be48359ce1546348f97">densmatr_mixDamping</a>(qureg, targetQubit, prob);</div>
<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>&#160;}</div>
<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>&#160; </div>
<div class="line"><a name="l01042"></a><span class="lineno"><a class="line" href="group__decoherence.html#gacfc45a8fc86ee18f60866bbd0c874ed0"> 1042</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#gacfc45a8fc86ee18f60866bbd0c874ed0">mixTwoQubitDepolarising</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qubit1, <span class="keywordtype">int</span> qubit2, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> prob) {</div>
<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a>(qureg, qubit1, qubit2, __func__);</div>
<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>&#160;    <a class="code" href="QuEST__validation_8c.html#abedaf81fa9ed252b2f8fbd1bd73f8f8e">validateTwoQubitDepolProb</a>(prob, __func__);</div>
<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>&#160;    </div>
<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>&#160;    <a class="code" href="QuEST__common_8c.html#ac8ea84dd85eca525daeeb30b3c96b673">ensureIndsIncrease</a>(&amp;qubit1, &amp;qubit2);</div>
<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a43afa97e300b87bce7f3eb1213eb05f6">densmatr_mixTwoQubitDepolarising</a>(qureg, qubit1, qubit2, (16*prob)/15.0);</div>
<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg,</div>
<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>&#160;        <span class="stringliteral">&quot;Here, a homogeneous depolarising error occured on qubits %d and %d &quot;</span></div>
<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>&#160;        <span class="stringliteral">&quot;with total probability %g&quot;</span>, qubit1, qubit2, prob);</div>
<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>&#160;}</div>
<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>&#160; </div>
<div class="line"><a name="l01054"></a><span class="lineno"><a class="line" href="group__decoherence.html#ga9a77f84e1aa7d25d036b14d7d0cd8b61"> 1054</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#ga9a77f84e1aa7d25d036b14d7d0cd8b61">mixPauli</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> probX, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> probY, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> probZ) {</div>
<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, qubit, __func__);</div>
<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a1b018a5766c1b26c731e8dcaa76abb19">validateOneQubitPauliProbs</a>(probX, probY, probZ, __func__);</div>
<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>&#160;    </div>
<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>&#160;    <a class="code" href="QuEST__common_8c.html#a63bf6575f12d7113fb854a2b6cc1a756">densmatr_mixPauli</a>(qureg, qubit, probX, probY, probZ);</div>
<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg,</div>
<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>&#160;        <span class="stringliteral">&quot;Here, X, Y and Z errors occured on qubit %d with probabilities &quot;</span></div>
<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>&#160;        <span class="stringliteral">&quot;%g, %g and %g respectively&quot;</span>, qubit, probX, probY, probZ);</div>
<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>&#160;}</div>
<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>&#160; </div>
<div class="line"><a name="l01065"></a><span class="lineno"><a class="line" href="group__decoherence.html#gacb7faa9d8afb0f4270c866424fffbccd"> 1065</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#gacb7faa9d8afb0f4270c866424fffbccd">mixKrausMap</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> target, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> *ops, <span class="keywordtype">int</span> numOps) {</div>
<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(qureg, target, __func__);</div>
<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a2d43dbc8bf59a58b0ba9da31a8b7db8b">validateOneQubitKrausMap</a>(qureg, ops, numOps, __func__);</div>
<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>&#160;    </div>
<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab987904f721746d1176aba7ac6b566fa">densmatr_mixKrausMap</a>(qureg, target, ops, numOps);</div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;        <span class="stringliteral">&quot;Here, an undisclosed Kraus map was effected on qubit %d&quot;</span>, target);</div>
<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>&#160;}</div>
<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>&#160; </div>
<div class="line"><a name="l01075"></a><span class="lineno"><a class="line" href="group__decoherence.html#ga2cf7dece0efea4207349f872cdcb7e81"> 1075</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#ga2cf7dece0efea4207349f872cdcb7e81">mixTwoQubitKrausMap</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> target1, <span class="keywordtype">int</span> target2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> *ops, <span class="keywordtype">int</span> numOps) {</div>
<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, (<span class="keywordtype">int</span>[]) {target1,target2}, 2, __func__);</div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ad0f5b8fe9cf31ef3a565e722966a5511">validateTwoQubitKrausMap</a>(qureg, ops, numOps, __func__);</div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;    </div>
<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;    <a class="code" href="QuEST__common_8c.html#ab004038b5f906ea897621c88bf213129">densmatr_mixTwoQubitKrausMap</a>(qureg, target1, target2, ops, numOps);</div>
<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg, </div>
<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;        <span class="stringliteral">&quot;Here, an undisclosed two-qubit Kraus map was effected on qubits %d and %d&quot;</span>, target1, target2);</div>
<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>&#160;}</div>
<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160; </div>
<div class="line"><a name="l01085"></a><span class="lineno"><a class="line" href="group__decoherence.html#ga65b4c0944090fae78a37ba3b94811ace"> 1085</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__decoherence.html#ga65b4c0944090fae78a37ba3b94811ace">mixMultiQubitKrausMap</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span>* targets, <span class="keywordtype">int</span> numTargets, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a>* ops, <span class="keywordtype">int</span> numOps) {</div>
<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>&#160;    <a class="code" href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a>(qureg, __func__);</div>
<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a>(qureg, targets, numTargets, __func__);</div>
<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a38738db33da795b9d52bace2d9fbe7ee">validateMultiQubitKrausMap</a>(qureg, numTargets, ops, numOps, __func__);</div>
<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>&#160;    </div>
<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>&#160;    <a class="code" href="QuEST__common_8c.html#a99702f4667c429969d7e7b4ecd45c2f3">densmatr_mixMultiQubitKrausMap</a>(qureg, targets, numTargets, ops, numOps);</div>
<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>&#160;    <a class="code" href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a>(qureg,</div>
<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>&#160;        <span class="stringliteral">&quot;Here, an undisclosed %d-qubit Kraus map was applied to undisclosed qubits&quot;</span>, numTargets);</div>
<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>&#160;}</div>
<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>&#160; </div>
<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>&#160;<span class="comment"> * other data structures </span></div>
<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>&#160; </div>
<div class="line"><a name="l01099"></a><span class="lineno"><a class="line" href="group__type.html#ga815103261fb22ea9690e1427571df00e"> 1099</a></span>&#160; <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> <a class="code" href="group__type.html#ga815103261fb22ea9690e1427571df00e">createComplexMatrixN</a>(<span class="keywordtype">int</span> numQubits) {</div>
<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>&#160;     <a class="code" href="QuEST__validation_8c.html#a7c8491926b4c7b4bf8e8123f4464a08e">validateNumQubitsInMatrix</a>(numQubits, __func__);</div>
<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>&#160; </div>
<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>&#160;     <span class="keywordtype">int</span> numRows = 1 &lt;&lt; numQubits;</div>
<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>&#160; </div>
<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>&#160;     <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> m = {</div>
<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>&#160;         .<a class="code" href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">numQubits</a> = numQubits,</div>
<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>&#160;         .real = malloc(numRows * <span class="keyword">sizeof</span> *m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>),</div>
<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>&#160;         .imag = malloc(numRows * <span class="keyword">sizeof</span> *m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>)};</div>
<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>&#160; </div>
<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>&#160;     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> n=0; n &lt; 1&lt;&lt;numQubits; n++) {</div>
<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>&#160;         m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[n] = calloc(numRows, <span class="keyword">sizeof</span> **m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>);</div>
<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>&#160;         m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>[n] = calloc(numRows, <span class="keyword">sizeof</span> **m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>);</div>
<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>&#160;     }</div>
<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>&#160;     </div>
<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>&#160;     <span class="comment">// error if the ComplexMatrixN was not successfully malloc&#39;ds</span></div>
<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>&#160;     <a class="code" href="QuEST__validation_8c.html#a6a3d99bc780707a90120a78a6e203792">validateMatrixInit</a>(m, __func__);</div>
<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>&#160;     </div>
<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>&#160;     <span class="keywordflow">return</span> m;</div>
<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>&#160; }</div>
<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>&#160; </div>
<div class="line"><a name="l01120"></a><span class="lineno"><a class="line" href="group__type.html#ga9df2f3d86be4a6e9aad481665e5e6753"> 1120</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#ga9df2f3d86be4a6e9aad481665e5e6753">destroyComplexMatrixN</a>(<a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> m) {</div>
<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>&#160;    <span class="comment">/* this checks m.real/imag != NULL, which is only ever set when the mallocs </span></div>
<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>&#160;<span class="comment">     * in createComplexMatrixN fail, which already prompts an error. Hence </span></div>
<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>&#160;<span class="comment">     * this check if useless </span></div>
<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6a3d99bc780707a90120a78a6e203792">validateMatrixInit</a>(m, __func__);</div>
<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>&#160;    </div>
<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>&#160;    <span class="keywordtype">int</span> numRows = 1 &lt;&lt; m.<a class="code" href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">numQubits</a>;</div>
<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> r=0; r &lt; numRows; r++) {</div>
<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>&#160;        free(m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[r]);</div>
<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>&#160;        free(m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>[r]);</div>
<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>&#160;    }</div>
<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>&#160;    free(m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>);</div>
<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>&#160;    free(m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>);</div>
<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>&#160;}</div>
<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>&#160; </div>
<div class="line"><a name="l01136"></a><span class="lineno"><a class="line" href="group__type.html#ga429f1b90b3ef06c786dec8c7f0eda4ce"> 1136</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#ga429f1b90b3ef06c786dec8c7f0eda4ce">initComplexMatrixN</a>(<a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> m, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> re[][1&lt;&lt;m.<a class="code" href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">numQubits</a>], <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> im[][1&lt;&lt;m.<a class="code" href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">numQubits</a>]) {</div>
<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6a3d99bc780707a90120a78a6e203792">validateMatrixInit</a>(m, __func__);</div>
<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>&#160;    </div>
<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>&#160;    <span class="keywordtype">int</span> dim = 1 &lt;&lt; m.<a class="code" href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">numQubits</a>;</div>
<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;dim; i++)</div>
<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;dim; j++) {</div>
<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>&#160;            m.<a class="code" href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">real</a>[i][j] = re[i][j];</div>
<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>&#160;            m.<a class="code" href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">imag</a>[i][j] = im[i][j];</div>
<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>&#160;        }</div>
<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>&#160;}</div>
<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>&#160; </div>
<div class="line"><a name="l01147"></a><span class="lineno"><a class="line" href="group__type.html#ga35b28710877c462927366fa602e591cb"> 1147</a></span>&#160;<a class="code" href="structPauliHamil.html">PauliHamil</a> <a class="code" href="group__type.html#ga35b28710877c462927366fa602e591cb">createPauliHamil</a>(<span class="keywordtype">int</span> numQubits, <span class="keywordtype">int</span> numSumTerms) {</div>
<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a7de9c41e77487a2939ed076f0cf674e7">validateHamilParams</a>(numQubits, numSumTerms, __func__);</div>
<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>&#160;    </div>
<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>&#160;    <a class="code" href="structPauliHamil.html">PauliHamil</a> h;</div>
<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>&#160;    h.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a> = numQubits;</div>
<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>&#160;    h.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a> = numSumTerms;</div>
<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>&#160;    h.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a> = malloc(numSumTerms * <span class="keyword">sizeof</span> *h.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>);</div>
<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>&#160;    h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a> = malloc(numQubits*numSumTerms * <span class="keyword">sizeof</span> *h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>);</div>
<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>&#160;    </div>
<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>&#160;    <span class="comment">// initialise pauli codes to identity </span></div>
<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i&lt;numQubits*numSumTerms; i++)</div>
<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>&#160;        h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>[i] = <a class="code" href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a>;</div>
<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>&#160;    </div>
<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>&#160;    <span class="keywordflow">return</span> h;</div>
<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>&#160;}</div>
<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>&#160; </div>
<div class="line"><a name="l01163"></a><span class="lineno"><a class="line" href="group__type.html#gac1c8ed909b33bd55ae680901006051b6"> 1163</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#gac1c8ed909b33bd55ae680901006051b6">destroyPauliHamil</a>(<a class="code" href="structPauliHamil.html">PauliHamil</a> h) {</div>
<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>&#160;    </div>
<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>&#160;    free(h.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>);</div>
<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>&#160;    free(h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>);</div>
<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>&#160;}</div>
<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>&#160; </div>
<div class="line"><a name="l01169"></a><span class="lineno"><a class="line" href="group__type.html#gaa77376c5e3518186eb085f37826d6008"> 1169</a></span>&#160;<a class="code" href="structPauliHamil.html">PauliHamil</a> <a class="code" href="group__type.html#gaa77376c5e3518186eb085f37826d6008">createPauliHamilFromFile</a>(<span class="keywordtype">char</span>* fn) {</div>
<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>&#160;    </div>
<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>&#160;    <span class="comment">/* The validation in this function must close the file handle and free </span></div>
<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>&#160;<span class="comment">     * allocated memory before raising an error (whether that&#39;s a C exit, or</span></div>
<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>&#160;<span class="comment">     * an overriden C++ exception).</span></div>
<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>&#160;    </div>
<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>&#160;        FILE* file = fopen(fn, <span class="stringliteral">&quot;r&quot;</span>);</div>
<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>&#160;    <span class="keywordtype">int</span> success = (file != NULL);</div>
<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6b9523909701f7bd79f2ab7b56a8e6bd">validateFileOpened</a>(success, fn, __func__);</div>
<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>&#160;    </div>
<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>&#160;    <span class="comment">/* file format: coeff {term} \n where {term} is #numQubits values of </span></div>
<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>&#160;<span class="comment">         * 0 1 2 3 signifying I X Y Z acting on that qubit index</span></div>
<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>&#160;<span class="comment">         */</span></div>
<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>&#160;        </div>
<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>&#160;        <span class="comment">// count the number of qubits (ignore trailing whitespace)</span></div>
<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>&#160;        <span class="keywordtype">int</span> numQubits = -1; <span class="comment">// to exclude coeff at start</span></div>
<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>&#160;        <span class="keywordtype">char</span> ch = getc(file);</div>
<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>&#160;    <span class="keywordtype">char</span> prev = <span class="charliteral">&#39;0&#39;</span>; <span class="comment">// anything not space</span></div>
<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>&#160;        <span class="keywordflow">while</span> (ch != <span class="charliteral">&#39;\n&#39;</span> &amp;&amp; ch != EOF) {</div>
<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>&#160;                <span class="keywordflow">if</span> (ch == <span class="charliteral">&#39; &#39;</span> &amp;&amp; prev != <span class="charliteral">&#39; &#39;</span>) <span class="comment">// skip multiple spaces</span></div>
<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>&#160;                        numQubits++;</div>
<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>&#160;        prev = ch;</div>
<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>&#160;        ch = getc(file);</div>
<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>&#160;    }</div>
<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>&#160;    <span class="comment">// edge-case: if we hit EOF/newline without a space</span></div>
<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>&#160;    <span class="keywordflow">if</span> (prev != <span class="charliteral">&#39; &#39;</span>)</div>
<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>&#160;        numQubits++;</div>
<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>&#160; </div>
<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>&#160;    <span class="comment">/* TODO:</span></div>
<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>&#160;<span class="comment">     * The below code may break on Windows where newlines are multiple characters</span></div>
<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>&#160;        </div>
<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>&#160;        <span class="comment">// count the number of terms (being cautious of trailing newlines)</span></div>
<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>&#160;    <span class="keywordtype">int</span> numTerms = 0;</div>
<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>&#160;    prev = <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>&#160;    rewind(file);</div>
<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>&#160;        <span class="keywordflow">while</span> ((ch=getc(file)) != EOF) {</div>
<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>&#160;                <span class="keywordflow">if</span> (ch == <span class="charliteral">&#39;\n&#39;</span> &amp;&amp; prev != <span class="charliteral">&#39;\n&#39;</span>)</div>
<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>&#160;                        numTerms++;</div>
<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>&#160;        prev = ch;</div>
<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>&#160;    }</div>
<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>&#160;    <span class="comment">// edge-case: if we hit EOF without a newline, count that line</span></div>
<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>&#160;    <span class="keywordflow">if</span> (prev != <span class="charliteral">&#39;\n&#39;</span>)</div>
<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>&#160;        numTerms++;</div>
<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>&#160; </div>
<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>&#160;    <span class="comment">// validate the inferred number of terms and qubits (closes file if error)</span></div>
<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a73bb5e6a5dcfba274ce93355d4a04db4">validateHamilFileParams</a>(numQubits, numTerms, file, fn, __func__);</div>
<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>&#160;    </div>
<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>&#160;    <span class="comment">// allocate space for PauliHamil data</span></div>
<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>&#160;    <a class="code" href="structPauliHamil.html">PauliHamil</a> h = <a class="code" href="group__type.html#ga35b28710877c462927366fa602e591cb">createPauliHamil</a>(numQubits, numTerms);</div>
<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>&#160;     </div>
<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>&#160;    <span class="comment">// specifier for a qreal number then a space </span></div>
<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>&#160;    <span class="keywordtype">char</span> strSpec[50];</div>
<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>&#160;    strcpy(strSpec, REAL_SPECIFIER);</div>
<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>&#160;    strcat(strSpec, <span class="stringliteral">&quot; &quot;</span>);</div>
<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>&#160;    </div>
<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>&#160;    <span class="comment">// collect coefficients and terms</span></div>
<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>&#160;        rewind(file);</div>
<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> t=0; t&lt;numTerms; t++) {</div>
<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>&#160;                </div>
<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>&#160;                <span class="comment">// record coefficient, and validate (closes file and frees h if error)</span></div>
<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>&#160;        success = fscanf(file, strSpec, &amp;(h.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>[t])) == 1;</div>
<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>&#160;        <a class="code" href="QuEST__validation_8c.html#a03b219da14463416c174c08b027deb31">validateHamilFileCoeffParsed</a>(success, h, file, fn, __func__);</div>
<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>&#160; </div>
<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>&#160;                <span class="comment">// record Pauli operations, and validate (closes file and frees h if error)</span></div>
<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> q=0; q&lt;numQubits; q++) {</div>
<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>&#160;            <span class="keywordtype">int</span> i = t*numQubits + q;</div>
<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>&#160;            </div>
<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>&#160;            <span class="comment">// verbose, to avoid type warnings</span></div>
<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>&#160;            <span class="keywordtype">int</span> code;</div>
<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>&#160;            success = fscanf(file, <span class="stringliteral">&quot;%d &quot;</span>, &amp;code) == 1;</div>
<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>&#160;            h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>[i] = (<span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>) code;</div>
<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>&#160;            <a class="code" href="QuEST__validation_8c.html#aab522b9871ea39eaf76d36850817e5bc">validateHamilFilePauliParsed</a>(success, h, file, fn, __func__);</div>
<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>&#160;            <a class="code" href="QuEST__validation_8c.html#a23a0025b20f876844320f40fc02cdb69">validateHamilFilePauliCode</a>(h.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>[i], h, file, fn, __func__);</div>
<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>&#160;                }</div>
<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>&#160; </div>
<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>&#160;                <span class="comment">// the trailing newline is magically eaten</span></div>
<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>&#160;        }</div>
<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>&#160; </div>
<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>&#160;    fclose(file);</div>
<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>&#160;        <span class="keywordflow">return</span> h;</div>
<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>&#160;}</div>
<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>&#160; </div>
<div class="line"><a name="l01253"></a><span class="lineno"><a class="line" href="group__type.html#gadbe6701dda1d49168f2f23253e370a7a"> 1253</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#gadbe6701dda1d49168f2f23253e370a7a">initPauliHamil</a>(<a class="code" href="structPauliHamil.html">PauliHamil</a> hamil, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* coeffs, <span class="keyword">enum</span> <a class="code" href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a>* codes) {</div>
<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a7de9c41e77487a2939ed076f0cf674e7">validateHamilParams</a>(hamil.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a>, hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>, __func__);</div>
<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>&#160;    <a class="code" href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a>(codes, hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>*hamil.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a>, __func__);</div>
<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>&#160;    </div>
<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>&#160;    <span class="keywordtype">int</span> i=0;</div>
<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> t=0; t&lt;hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>; t++) {</div>
<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>&#160;        hamil.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>[t] = coeffs[t];</div>
<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> q=0; q&lt;hamil.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a>; q++) {</div>
<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>&#160;            hamil.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>[i] = codes[i];</div>
<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>&#160;            i++;</div>
<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>&#160;        }</div>
<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>&#160;    }</div>
<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>&#160;}</div>
<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>&#160; </div>
<div class="line"><a name="l01267"></a><span class="lineno"><a class="line" href="group__type.html#gaebf896dd8d5eeaf9fd896f6cc8e334fe"> 1267</a></span>&#160;<a class="code" href="structDiagonalOp.html">DiagonalOp</a> <a class="code" href="group__type.html#gaebf896dd8d5eeaf9fd896f6cc8e334fe">createDiagonalOp</a>(<span class="keywordtype">int</span> numQubits, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a7891142f169db6d440a4145501cd1d4c">validateNumQubitsInDiagOp</a>(numQubits, env.<a class="code" href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">numRanks</a>, __func__);</div>
<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>&#160;    </div>
<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#a0b84e6766bd682708e6211276ff0a5bb">agnostic_createDiagonalOp</a>(numQubits, env);</div>
<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>&#160;}</div>
<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>&#160; </div>
<div class="line"><a name="l01273"></a><span class="lineno"><a class="line" href="group__type.html#ga2c59f45fab56708f687b4104ee99bcd1"> 1273</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#ga2c59f45fab56708f687b4104ee99bcd1">destroyDiagonalOp</a>(<a class="code" href="structDiagonalOp.html">DiagonalOp</a> op, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>&#160;    <span class="comment">// env accepted for API consistency</span></div>
<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac5bd32bc24176e616a288ae04752fc9c">validateDiagOpInit</a>(op, __func__);</div>
<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>&#160;    </div>
<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>&#160;    <a class="code" href="QuEST__internal_8h.html#af798bb01f922804016c4c5bc8d0a580f">agnostic_destroyDiagonalOp</a>(op);</div>
<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>&#160;}</div>
<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>&#160; </div>
<div class="line"><a name="l01280"></a><span class="lineno"><a class="line" href="group__type.html#gab75d5cdc622d2778bad24e3a8130aab9"> 1280</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#gab75d5cdc622d2778bad24e3a8130aab9">syncDiagonalOp</a>(<a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac5bd32bc24176e616a288ae04752fc9c">validateDiagOpInit</a>(op, __func__);</div>
<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>&#160;    </div>
<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1e8f917ab42d38d8c37ba6816b24f2f5">agnostic_syncDiagonalOp</a>(op);</div>
<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>&#160;}</div>
<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>&#160; </div>
<div class="line"><a name="l01286"></a><span class="lineno"><a class="line" href="group__type.html#ga12a6c59ebbfba8bdb9453a4138027d46"> 1286</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#ga12a6c59ebbfba8bdb9453a4138027d46">initDiagonalOp</a>(<a class="code" href="structDiagonalOp.html">DiagonalOp</a> op, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* real, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imag) {</div>
<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac5bd32bc24176e616a288ae04752fc9c">validateDiagOpInit</a>(op, __func__);</div>
<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>&#160;    </div>
<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ab58d6d599c7a729255b1f8eeded663f3">agnostic_setDiagonalOpElems</a>(op, 0, real, imag, 1LL &lt;&lt; op.<a class="code" href="structDiagonalOp.html#a5131eeb67aafb4c19ac98270c3266742">numQubits</a>);</div>
<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>&#160;}</div>
<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>&#160; </div>
<div class="line"><a name="l01292"></a><span class="lineno"><a class="line" href="group__type.html#gafabb15a6c1cf49f8ecb67e1f35c77c1e"> 1292</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#gafabb15a6c1cf49f8ecb67e1f35c77c1e">setDiagonalOpElems</a>(<a class="code" href="structDiagonalOp.html">DiagonalOp</a> op, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> startInd, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* real, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imag, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numElems) {</div>
<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac5bd32bc24176e616a288ae04752fc9c">validateDiagOpInit</a>(op, __func__);</div>
<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a1c52594c03d2c136993b27f4dd315c11">validateNumElems</a>(op, startInd, numElems, __func__);</div>
<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>&#160;    </div>
<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ab58d6d599c7a729255b1f8eeded663f3">agnostic_setDiagonalOpElems</a>(op, startInd, real, imag, numElems);</div>
<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>&#160;}</div>
<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>&#160; </div>
<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>&#160;<span class="comment"> * debug</span></div>
<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>&#160; </div>
<div class="line"><a name="l01303"></a><span class="lineno"><a class="line" href="QuEST__debug_8h.html#a0bef4d330656ba2265569506a0a6400f"> 1303</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="QuEST_8c.html#acb5e66108a5c6cf36642148335c0d9ab">compareStates</a>(<a class="code" href="structQureg.html">Qureg</a> qureg1, <a class="code" href="structQureg.html">Qureg</a> qureg2, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> precision) {</div>
<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a>(qureg1, qureg2, __func__);</div>
<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__internal_8h.html#ae6cecbad32a03416138b321cdc1a2c33">statevec_compareStates</a>(qureg1, qureg2, precision);</div>
<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>&#160;}</div>
<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>&#160; </div>
<div class="line"><a name="l01308"></a><span class="lineno"><a class="line" href="group__debug.html#gaa696c94112e5fbbc996af10dfc4e2c1c"> 1308</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#gaa696c94112e5fbbc996af10dfc4e2c1c">initDebugState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>&#160;    <a class="code" href="QuEST__internal_8h.html#ad9fd3017ea40cf63fd04b39e03494972">statevec_initDebugState</a>(qureg);</div>
<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>&#160;}</div>
<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>&#160; </div>
<div class="line"><a name="l01312"></a><span class="lineno"><a class="line" href="QuEST__debug_8h.html#a6456bc310db1989c5b17febdb23c2c93"> 1312</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST_8c.html#a6456bc310db1989c5b17febdb23c2c93">initStateFromSingleFile</a>(<a class="code" href="structQureg.html">Qureg</a> *qureg, <span class="keywordtype">char</span> filename[200], <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env) {</div>
<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>&#160;    <span class="keywordtype">int</span> success = <a class="code" href="QuEST__internal_8h.html#a05756b45f10135bb2eeb07380f806c20">statevec_initStateFromSingleFile</a>(qureg, filename, env);</div>
<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a6b9523909701f7bd79f2ab7b56a8e6bd">validateFileOpened</a>(success, filename, __func__);</div>
<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>&#160;}</div>
<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>&#160; </div>
<div class="line"><a name="l01317"></a><span class="lineno"><a class="line" href="QuEST__debug_8h.html#a7ba64480d4c3f7b1c3ea90cc0245f3e8"> 1317</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST_8c.html#a7ba64480d4c3f7b1c3ea90cc0245f3e8">initStateOfSingleQubit</a>(<a class="code" href="structQureg.html">Qureg</a> *qureg, <span class="keywordtype">int</span> qubitId, <span class="keywordtype">int</span> outcome) {</div>
<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a>(*qureg, __func__);</div>
<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a>(*qureg, qubitId, __func__);</div>
<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>&#160;    <a class="code" href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a>(outcome, __func__);</div>
<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a923906770cac0da9e3459bae58de9e64">statevec_initStateOfSingleQubit</a>(qureg, qubitId, outcome);</div>
<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>&#160;}</div>
<div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>&#160; </div>
<div class="line"><a name="l01324"></a><span class="lineno"><a class="line" href="group__debug.html#gaa33ed720560d051eb4126b4a534bc4c6"> 1324</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#gaa33ed720560d051eb4126b4a534bc4c6">reportStateToScreen</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env, <span class="keywordtype">int</span> reportRank)  {</div>
<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a1e57230c7995447039e62a84c0a36524">statevec_reportStateToScreen</a>(qureg, env, reportRank);</div>
<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>&#160;}</div>
<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>&#160; </div>
<div class="line"><a name="l01328"></a><span class="lineno"><a class="line" href="group__debug.html#gab27234d9ccf440bb5e5d834e8f7e3938"> 1328</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#gab27234d9ccf440bb5e5d834e8f7e3938">reportPauliHamil</a>(<a class="code" href="structPauliHamil.html">PauliHamil</a> hamil) {</div>
<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>&#160;    <a class="code" href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a>(hamil, __func__);</div>
<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>&#160;    </div>
<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> t=0; t&lt;hamil.<a class="code" href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">numSumTerms</a>; t++) {</div>
<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>&#160;        printf(<span class="stringliteral">&quot;%g\t&quot;</span>, hamil.<a class="code" href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">termCoeffs</a>[t]);</div>
<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> q=0; q&lt;hamil.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a>; q++)</div>
<div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>&#160;            printf(<span class="stringliteral">&quot;%d &quot;</span>, (<span class="keywordtype">int</span>) hamil.<a class="code" href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">pauliCodes</a>[q+t*hamil.<a class="code" href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">numQubits</a>]);</div>
<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>&#160;        printf(<span class="stringliteral">&quot;\n&quot;</span>);</div>
<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>&#160;    }</div>
<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>&#160;}</div>
<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>&#160; </div>
<div class="line"><a name="l01339"></a><span class="lineno"><a class="line" href="QuEST_8c.html#acd34ae4aa7e7f466316cc104532c85c1"> 1339</a></span>&#160;<span class="keywordtype">int</span>  <a class="code" href="QuEST_8c.html#acd34ae4aa7e7f466316cc104532c85c1">getQuEST_PREC</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>&#160;  <span class="keywordflow">return</span> <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>)/4;</div>
<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>&#160;}</div>
<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>&#160;  </div>
<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>&#160; </div>
<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>&#160;}</div>
<div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aQuEST__internal_8h_html_af798bb01f922804016c4c5bc8d0a580f"><div class="ttname"><a href="QuEST__internal_8h.html#af798bb01f922804016c4c5bc8d0a580f">agnostic_destroyDiagonalOp</a></div><div class="ttdeci">void agnostic_destroyDiagonalOp(DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01357">QuEST_cpu.c:1357</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a398b60c4cb4fa2cf2ffc126de6c08da0"><div class="ttname"><a href="QuEST__internal_8h.html#a398b60c4cb4fa2cf2ffc126de6c08da0">densmatr_mixDepolarising</a></div><div class="ttdeci">void densmatr_mixDepolarising(Qureg qureg, int targetQubit, qreal depolLevel)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00698">QuEST_cpu_distributed.c:698</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga7eb969c1dd6c949aecf716d2fba71120"><div class="ttname"><a href="group__unitary.html#ga7eb969c1dd6c949aecf716d2fba71120">controlledRotateZ</a></div><div class="ttdeci">void controlledRotateZ(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdoc">Applies a controlled rotation by a given angle around the Z-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00245">QuEST.c:245</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a9d97fdaec443ed238c1e72e387a688e3"><div class="ttname"><a href="QuEST__qasm_8c.html#a9d97fdaec443ed238c1e72e387a688e3">qasm_printRecorded</a></div><div class="ttdeci">void qasm_printRecorded(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00484">QuEST_qasm.c:484</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a5ef139196852f92fe8271c82964eadff"><div class="ttname"><a href="QuEST__common_8c.html#a5ef139196852f92fe8271c82964eadff">statevec_phaseShift</a></div><div class="ttdeci">void statevec_phaseShift(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00251">QuEST_common.c:251</a></div></div>
<div class="ttc" id="agroup__decoherence_html_gacc2667ac87482a7afdcb711b74bf732e"><div class="ttname"><a href="group__decoherence.html#gacc2667ac87482a7afdcb711b74bf732e">mixDephasing</a></div><div class="ttdeci">void mixDephasing(Qureg qureg, int targetQubit, qreal prob)</div><div class="ttdoc">Mixes a density matrix qureg to induce single-qubit dephasing noise.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01001">QuEST.c:1001</a></div></div>
<div class="ttc" id="aQuEST_8c_html_acb5e66108a5c6cf36642148335c0d9ab"><div class="ttname"><a href="QuEST_8c.html#acb5e66108a5c6cf36642148335c0d9ab">compareStates</a></div><div class="ttdeci">int compareStates(Qureg qureg1, Qureg qureg2, qreal precision)</div><div class="ttdoc">Return whether two given wavefunctions are equivalent within a given precision Global phase included ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01303">QuEST.c:1303</a></div></div>
<div class="ttc" id="agroup__calc_html_ga4a14d22379d399760b0cfc5c8053589b"><div class="ttname"><a href="group__calc.html#ga4a14d22379d399760b0cfc5c8053589b">getProbAmp</a></div><div class="ttdeci">qreal getProbAmp(Qureg qureg, long long int index)</div><div class="ttdoc">Get the probability of a state-vector at an index in the full state vector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00692">QuEST.c:692</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_af22919f5190ca1b3b6b52b8f2fb8213b"><div class="ttname"><a href="QuEST__validation_8c.html#af22919f5190ca1b3b6b52b8f2fb8213b">validateDensityMatrQureg</a></div><div class="ttdeci">void validateDensityMatrQureg(Qureg qureg, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00483">QuEST_validation.c:483</a></div></div>
<div class="ttc" id="agroup__init_html_gada7230491a50cd409f8b00f5ee1db953"><div class="ttname"><a href="group__init.html#gada7230491a50cd409f8b00f5ee1db953">initBlankState</a></div><div class="ttdeci">void initBlankState(Qureg qureg)</div><div class="ttdoc">Initialises a qureg to have all-zero-amplitudes.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00119">QuEST.c:119</a></div></div>
<div class="ttc" id="astructVector_html"><div class="ttname"><a href="structVector.html">Vector</a></div><div class="ttdoc">Represents a 3-vector of real numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00148">QuEST.h:148</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a97f43ad2fe1ffc1f77a9b2af2f5f1cc2"><div class="ttname"><a href="QuEST__validation_8c.html#a97f43ad2fe1ffc1f77a9b2af2f5f1cc2">validateMultiControlsTarget</a></div><div class="ttdeci">void validateMultiControlsTarget(Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00416">QuEST_validation.c:416</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a559d175d31cec552fc09aec3e8a78d11"><div class="ttname"><a href="QuEST__common_8c.html#a559d175d31cec552fc09aec3e8a78d11">statevec_sGate</a></div><div class="ttdeci">void statevec_sGate(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00265">QuEST_common.c:265</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab14df201e5c05527dc77cfeb6f583042"><div class="ttname"><a href="QuEST__common_8c.html#ab14df201e5c05527dc77cfeb6f583042">statevec_pauliZ</a></div><div class="ttdeci">void statevec_pauliZ(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00258">QuEST_common.c:258</a></div></div>
<div class="ttc" id="agroup__type_html_ga1c703cf89629e4e9c7023cd402d67028"><div class="ttname"><a href="group__type.html#ga1c703cf89629e4e9c7023cd402d67028">pauliOpType</a></div><div class="ttdeci">pauliOpType</div><div class="ttdoc">Codes for specifying Pauli operators.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab8687e6ea5cf35503c223051837f3b94"><div class="ttname"><a href="QuEST__common_8c.html#ab8687e6ea5cf35503c223051837f3b94">statevec_rotateX</a></div><div class="ttdeci">void statevec_rotateX(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00293">QuEST_common.c:293</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a8accabb8a9d573c2ff80305841c3053d"><div class="ttname"><a href="QuEST__validation_8c.html#a8accabb8a9d573c2ff80305841c3053d">validateMeasurementProb</a></div><div class="ttdeci">void validateMeasurementProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00491">QuEST_validation.c:491</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ac31c45c5a31c523be0eb26abba6cf598"><div class="ttname"><a href="QuEST__validation_8c.html#ac31c45c5a31c523be0eb26abba6cf598">validateTarget</a></div><div class="ttdeci">void validateTarget(Qureg qureg, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00364">QuEST_validation.c:364</a></div></div>
<div class="ttc" id="agroup__operator_html_gab52b6315c5520b7d311b0458785eed8e"><div class="ttname"><a href="group__operator.html#gab52b6315c5520b7d311b0458785eed8e">applyMultiControlledMatrixN</a></div><div class="ttdeci">void applyMultiControlledMatrixN(Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general N-by-N matrix, which may be non-unitary, with additional controlled qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00874">QuEST.c:874</a></div></div>
<div class="ttc" id="agroup__unitary_html_gab525a42d63233f61afeb6be97d89dd36"><div class="ttname"><a href="group__unitary.html#gab525a42d63233f61afeb6be97d89dd36">twoQubitUnitary</a></div><div class="ttdeci">void twoQubitUnitary(Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">Apply a general two-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00257">QuEST.c:257</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga13f904b417f647c70d163770e65906fc"><div class="ttname"><a href="group__unitary.html#ga13f904b417f647c70d163770e65906fc">controlledRotateX</a></div><div class="ttdeci">void controlledRotateX(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdoc">Applies a controlled rotation by a given angle around the X-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00221">QuEST.c:221</a></div></div>
<div class="ttc" id="agroup__type_html_gadbe6701dda1d49168f2f23253e370a7a"><div class="ttname"><a href="group__type.html#gadbe6701dda1d49168f2f23253e370a7a">initPauliHamil</a></div><div class="ttdeci">void initPauliHamil(PauliHamil hamil, qreal *coeffs, enum pauliOpType *codes)</div><div class="ttdoc">Initialise a PauliHamil instance with the given term coefficients and Pauli codes (one for every qubi...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01253">QuEST.c:1253</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ad613c75ff252a88e54f911053bd2032c"><div class="ttname"><a href="QuEST__validation_8c.html#ad613c75ff252a88e54f911053bd2032c">validateOutcome</a></div><div class="ttdeci">void validateOutcome(int outcome, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00487">QuEST_validation.c:487</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab987904f721746d1176aba7ac6b566fa"><div class="ttname"><a href="QuEST__common_8c.html#ab987904f721746d1176aba7ac6b566fa">densmatr_mixKrausMap</a></div><div class="ttdeci">void densmatr_mixKrausMap(Qureg qureg, int target, ComplexMatrix2 *ops, int numOps)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00600">QuEST_common.c:600</a></div></div>
<div class="ttc" id="agroup__init_html_ga9a348df3e1df623c3d4c4f12c3ee3fe8"><div class="ttname"><a href="group__init.html#ga9a348df3e1df623c3d4c4f12c3ee3fe8">initPureState</a></div><div class="ttdeci">void initPureState(Qureg qureg, Qureg pure)</div><div class="ttdoc">Initialise a set of  qubits, which can be a state vector or density matrix, to a given pure state.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00145">QuEST.c:145</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga4c708f066b244801e10f538b48b90145"><div class="ttname"><a href="group__unitary.html#ga4c708f066b244801e10f538b48b90145">rotateAroundAxis</a></div><div class="ttdeci">void rotateAroundAxis(Qureg qureg, int rotQubit, qreal angle, Vector axis)</div><div class="ttdoc">Rotate a single qubit by a given angle around a given Vector on the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00575">QuEST.c:575</a></div></div>
<div class="ttc" id="agroup__decoherence_html_gae2ea9255b8b11a4a382231e5604dc4e3"><div class="ttname"><a href="group__decoherence.html#gae2ea9255b8b11a4a382231e5604dc4e3">mixDepolarising</a></div><div class="ttdeci">void mixDepolarising(Qureg qureg, int targetQubit, qreal prob)</div><div class="ttdoc">Mixes a density matrix qureg to induce single-qubit homogeneous depolarising noise.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01023">QuEST.c:1023</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a03b219da14463416c174c08b027deb31"><div class="ttname"><a href="QuEST__validation_8c.html#a03b219da14463416c174c08b027deb31">validateHamilFileCoeffParsed</a></div><div class="ttdeci">void validateHamilFileCoeffParsed(int parsed, PauliHamil h, FILE *file, char *fn, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00637">QuEST_validation.c:637</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_aabeb3e9ec6b2f30938c4cf9592e624fa"><div class="ttname"><a href="QuEST__qasm_8c.html#aabeb3e9ec6b2f30938c4cf9592e624fa">qasm_recordParamGate</a></div><div class="ttdeci">void qasm_recordParamGate(Qureg qureg, TargetGate gate, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00186">QuEST_qasm.c:186</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a57dc69bb7a2217aafca676b0923d5e27"><div class="ttname"><a href="QuEST__validation_8c.html#a57dc69bb7a2217aafca676b0923d5e27">validateStateIndex</a></div><div class="ttdeci">void validateStateIndex(Qureg qureg, long long int stateInd, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00341">QuEST_validation.c:341</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a2418bd9a6b9e6a0acf11faf5982d5d29"><div class="ttname"><a href="QuEST__internal_8h.html#a2418bd9a6b9e6a0acf11faf5982d5d29">densmatr_initPlusState</a></div><div class="ttdeci">void densmatr_initPlusState(Qureg targetQureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01154">QuEST_cpu.c:1154</a></div></div>
<div class="ttc" id="agroup__calc_html_gab082910d33473ec29e1d5852943de468"><div class="ttname"><a href="group__calc.html#gab082910d33473ec29e1d5852943de468">calcTotalProb</a></div><div class="ttdeci">qreal calcTotalProb(Qureg qureg)</div><div class="ttdoc">A debugging function which calculates the probability of the qubits in qureg being in any state,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00903">QuEST.c:903</a></div></div>
<div class="ttc" id="agroup__decoherence_html_gaea8509011985522bae857bd3b13c34ed"><div class="ttname"><a href="group__decoherence.html#gaea8509011985522bae857bd3b13c34ed">mixDamping</a></div><div class="ttdeci">void mixDamping(Qureg qureg, int targetQubit, qreal prob)</div><div class="ttdoc">Mixes a density matrix qureg to induce single-qubit amplitude damping (decay to 0 state).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01034">QuEST.c:1034</a></div></div>
<div class="ttc" id="agroup__type_html_ga9df2f3d86be4a6e9aad481665e5e6753"><div class="ttname"><a href="group__type.html#ga9df2f3d86be4a6e9aad481665e5e6753">destroyComplexMatrixN</a></div><div class="ttdeci">void destroyComplexMatrixN(ComplexMatrixN m)</div><div class="ttdoc">Destroy a ComplexMatrixN instance created with createComplexMatrixN()</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01120">QuEST.c:1120</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_acf1c651a4359a370a2d9b3e1e1ebd430"><div class="ttname"><a href="QuEST__common_8c.html#acf1c651a4359a370a2d9b3e1e1ebd430">shiftIndices</a></div><div class="ttdeci">void shiftIndices(int *indices, int numIndices, int shift)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00150">QuEST_common.c:150</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a6ff3dc624b5fafe8edae4fe327c255a0"><div class="ttname"><a href="QuEST__internal_8h.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a></div><div class="ttdeci">qreal densmatr_calcInnerProduct(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00441">QuEST_cpu_distributed.c:441</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aef380928d1b0003411d6159ca6594cd5"><div class="ttname"><a href="QuEST__common_8c.html#aef380928d1b0003411d6159ca6594cd5">statevec_calcExpecPauliProd</a></div><div class="ttdeci">qreal statevec_calcExpecPauliProd(Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00465">QuEST_common.c:465</a></div></div>
<div class="ttc" id="agroup__debug_html_gab27234d9ccf440bb5e5d834e8f7e3938"><div class="ttname"><a href="group__debug.html#gab27234d9ccf440bb5e5d834e8f7e3938">reportPauliHamil</a></div><div class="ttdeci">void reportPauliHamil(PauliHamil hamil)</div><div class="ttdoc">Print the PauliHamil to screen.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01328">QuEST.c:1328</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a7de9c41e77487a2939ed076f0cf674e7"><div class="ttname"><a href="QuEST__validation_8c.html#a7de9c41e77487a2939ed076f0cf674e7">validateHamilParams</a></div><div class="ttdeci">void validateHamilParams(int numQubits, int numTerms, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00615">QuEST_validation.c:615</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_ae5ef90741274785eb1ebbbe828b7df8a"><div class="ttname"><a href="QuEST__qasm_8c.html#ae5ef90741274785eb1ebbbe828b7df8a">qasm_free</a></div><div class="ttdeci">void qasm_free(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00500">QuEST_qasm.c:500</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ad7ac4934371d72e24c6d1cea3d3da391"><div class="ttname"><a href="QuEST__common_8c.html#ad7ac4934371d72e24c6d1cea3d3da391">statevec_controlledTwoQubitUnitary</a></div><div class="ttdeci">void statevec_controlledTwoQubitUnitary(Qureg qureg, int controlQubit, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00523">QuEST_common.c:523</a></div></div>
<div class="ttc" id="agroup__type_html_gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a"><div class="ttname"><a href="group__type.html#gga1c703cf89629e4e9c7023cd402d67028a63800f45b01ccc2608f754aee850bf4a">PAULI_I</a></div><div class="ttdeci">@ PAULI_I</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00096">QuEST.h:96</a></div></div>
<div class="ttc" id="agroup__calc_html_gadca286c4ad5cde6124d4e80a7ab95a68"><div class="ttname"><a href="group__calc.html#gadca286c4ad5cde6124d4e80a7ab95a68">getDensityAmp</a></div><div class="ttdeci">Complex getDensityAmp(Qureg qureg, long long int row, long long int col)</div><div class="ttdoc">Get an amplitude from a density matrix at a given row and column.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00709">QuEST.c:709</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fadfa058950331ffdba0bf56cb2272e01f">GATE_T</a></div><div class="ttdeci">@ GATE_T</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00024">QuEST_qasm.h:24</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html"><div class="ttname"><a href="QuEST__internal_8h.html">QuEST_internal.h</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa4668b36d21aaeba1fb605b73881ca507">GATE_PHASE_SHIFT</a></div><div class="ttdeci">@ GATE_PHASE_SHIFT</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00032">QuEST_qasm.h:32</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_ad22260712869e79f07d2f04e2b41a233"><div class="ttname"><a href="QuEST__qasm_8c.html#ad22260712869e79f07d2f04e2b41a233">qasm_recordUnitary</a></div><div class="ttdeci">void qasm_recordUnitary(Qureg qureg, ComplexMatrix2 u, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00207">QuEST_qasm.c:207</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a72feec2aaa05f98aed7f3c3fee141251"><div class="ttname"><a href="QuEST__validation_8c.html#a72feec2aaa05f98aed7f3c3fee141251">validateStateVecQureg</a></div><div class="ttdeci">void validateStateVecQureg(Qureg qureg, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00479">QuEST_validation.c:479</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a4e21adca1f0ca03303bc2e57aaba4ce2"><div class="ttname"><a href="QuEST__qasm_8c.html#a4e21adca1f0ca03303bc2e57aaba4ce2">qasm_recordInitZero</a></div><div class="ttdeci">void qasm_recordInitZero(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00415">QuEST_qasm.c:415</a></div></div>
<div class="ttc" id="agroup__type_html_ga815103261fb22ea9690e1427571df00e"><div class="ttname"><a href="group__type.html#ga815103261fb22ea9690e1427571df00e">createComplexMatrixN</a></div><div class="ttdeci">ComplexMatrixN createComplexMatrixN(int numQubits)</div><div class="ttdoc">Create (dynamically) a square complex matrix which can be passed to the multi-qubit general unitary f...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01099">QuEST.c:1099</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ae0cfea24091c8336146aa84c2253992e"><div class="ttname"><a href="QuEST__common_8c.html#ae0cfea24091c8336146aa84c2253992e">statevec_calcExpecPauliSum</a></div><div class="ttdeci">qreal statevec_calcExpecPauliSum(Qureg qureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00480">QuEST_common.c:480</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_abecd71c919a35e5a87b07ba400edc7c2"><div class="ttname"><a href="QuEST__qasm_8c.html#abecd71c919a35e5a87b07ba400edc7c2">qasm_recordMultiControlledGate</a></div><div class="ttdeci">void qasm_recordMultiControlledGate(Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00316">QuEST_qasm.c:316</a></div></div>
<div class="ttc" id="agroup__calc_html_gad575782de461d9ab0975b38cc7850f1a"><div class="ttname"><a href="group__calc.html#gad575782de461d9ab0975b38cc7850f1a">getImagAmp</a></div><div class="ttdeci">qreal getImagAmp(Qureg qureg, long long int index)</div><div class="ttdoc">Get the imaginary component of the complex probability amplitude at an index in the state vector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00685">QuEST.c:685</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aa28b7d9c0c3cf9c4be0e324fb9d6bf76"><div class="ttname"><a href="QuEST__validation_8c.html#aa28b7d9c0c3cf9c4be0e324fb9d6bf76">validateMultiQubitMatrixFitsInNode</a></div><div class="ttdeci">void validateMultiQubitMatrixFitsInNode(Qureg qureg, int numTargets, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00437">QuEST_validation.c:437</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga0c84c429cb1d7e2596706c1804dd9cba"><div class="ttname"><a href="group__unitary.html#ga0c84c429cb1d7e2596706c1804dd9cba">controlledRotateAroundAxis</a></div><div class="ttdeci">void controlledRotateAroundAxis(Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis)</div><div class="ttdoc">Applies a controlled rotation by a given angle around a given vector on the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00588">QuEST.c:588</a></div></div>
<div class="ttc" id="agroup__decoherence_html_gacb7faa9d8afb0f4270c866424fffbccd"><div class="ttname"><a href="group__decoherence.html#gacb7faa9d8afb0f4270c866424fffbccd">mixKrausMap</a></div><div class="ttdeci">void mixKrausMap(Qureg qureg, int target, ComplexMatrix2 *ops, int numOps)</div><div class="ttdoc">Apply a general single-qubit Kraus map to a density matrix, as specified by at most four Kraus operat...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01065">QuEST.c:1065</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a95abbe0cedf45b1ff2f070dba219fd7f"><div class="ttname"><a href="QuEST__common_8c.html#a95abbe0cedf45b1ff2f070dba219fd7f">statevec_twoQubitUnitary</a></div><div class="ttdeci">void statevec_twoQubitUnitary(Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00517">QuEST_common.c:517</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a086fffa88b1aeec1405aa2dc41eab8a3"><div class="ttname"><a href="QuEST__common_8c.html#a086fffa88b1aeec1405aa2dc41eab8a3">statevec_tGateConj</a></div><div class="ttdeci">void statevec_tGateConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00286">QuEST_common.c:286</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae45eefa65f4ecd37bab84fade7cf7f1f"><div class="ttname"><a href="QuEST__internal_8h.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a></div><div class="ttdeci">qreal densmatr_calcPurity(Qureg qureg)</div><div class="ttdoc">Computes the trace of the density matrix squared.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01288">QuEST_cpu_distributed.c:1288</a></div></div>
<div class="ttc" id="agroup__type_html_gab75d5cdc622d2778bad24e3a8130aab9"><div class="ttname"><a href="group__type.html#gab75d5cdc622d2778bad24e3a8130aab9">syncDiagonalOp</a></div><div class="ttdeci">void syncDiagonalOp(DiagonalOp op)</div><div class="ttdoc">Copy the elements in DiagonalOp op.real and op.imag to the persisent GPU memory.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01280">QuEST.c:1280</a></div></div>
<div class="ttc" id="agroup__type_html_ga2c59f45fab56708f687b4104ee99bcd1"><div class="ttname"><a href="group__type.html#ga2c59f45fab56708f687b4104ee99bcd1">destroyDiagonalOp</a></div><div class="ttdeci">void destroyDiagonalOp(DiagonalOp op, QuESTEnv env)</div><div class="ttdoc">Destroys a DiagonalOp created with createDiagonalOp(), freeing its memory.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01273">QuEST.c:1273</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga65c7879947e398690a5428bd43e143e3"><div class="ttname"><a href="group__unitary.html#ga65c7879947e398690a5428bd43e143e3">multiControlledTwoQubitUnitary</a></div><div class="ttdeci">void multiControlledTwoQubitUnitary(Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">Apply a general multi-controlled two-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00283">QuEST.c:283</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6904359f35d0b61b2c8fcecfac836033"><div class="ttname"><a href="QuEST__validation_8c.html#a6904359f35d0b61b2c8fcecfac836033">validateNumAmps</a></div><div class="ttdeci">void validateNumAmps(Qureg qureg, long long int startInd, long long int numAmps, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00351">QuEST_validation.c:351</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_af2cdfa07be122a2c0b0e950ef45450bc"><div class="ttname"><a href="QuEST__qasm_8c.html#af2cdfa07be122a2c0b0e950ef45450bc">qasm_clearRecorded</a></div><div class="ttdeci">void qasm_clearRecorded(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00477">QuEST_qasm.c:477</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ac3735bd959600e57b2ee3a105666cddf"><div class="ttname"><a href="QuEST__internal_8h.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a></div><div class="ttdeci">void statevec_unitary(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00881">QuEST_cpu_distributed.c:881</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a627b0be7667c5a61a06b3b038fcc8b1b"><div class="ttname"><a href="QuEST__qasm_8c.html#a627b0be7667c5a61a06b3b038fcc8b1b">qasm_recordInitPlus</a></div><div class="ttdeci">void qasm_recordInitPlus(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00430">QuEST_qasm.c:430</a></div></div>
<div class="ttc" id="agroup__normgate_html_ga34457f7f62ccd75fb7d3fe67cd2f815a"><div class="ttname"><a href="group__normgate.html#ga34457f7f62ccd75fb7d3fe67cd2f815a">collapseToOutcome</a></div><div class="ttdeci">qreal collapseToOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdoc">Updates qureg to be consistent with measuring measureQubit in the given outcome (0 or 1),...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00726">QuEST.c:726</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a20d45e85dd49dd3bf6045990b590b24b"><div class="ttname"><a href="QuEST__common_8c.html#a20d45e85dd49dd3bf6045990b590b24b">getConjugateMatrix4</a></div><div class="ttdeci">ComplexMatrix4 getConjugateMatrix4(ComplexMatrix4 src)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00104">QuEST_common.c:104</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fada07505b73935b2788032efd30a1a361">GATE_ROTATE_X</a></div><div class="ttdeci">@ GATE_ROTATE_X</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00027">QuEST_qasm.h:27</a></div></div>
<div class="ttc" id="aQuEST_8h_html"><div class="ttname"><a href="QuEST_8h.html">QuEST.h</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a45428d4a49b8798a8d25a7155f622238"><div class="ttname"><a href="QuEST__validation_8c.html#a45428d4a49b8798a8d25a7155f622238">validateNumQubitsInQureg</a></div><div class="ttdeci">void validateNumQubitsInQureg(int numQubits, int numRanks, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00313">QuEST_validation.c:313</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ab9947ff071a0c019f715f04b3833dcfd"><div class="ttname"><a href="QuEST__validation_8c.html#ab9947ff071a0c019f715f04b3833dcfd">validateMultiQubitUnitaryMatrix</a></div><div class="ttdeci">void validateMultiQubitUnitaryMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00466">QuEST_validation.c:466</a></div></div>
<div class="ttc" id="agroup__calc_html_ga683779343fb2c6055f6b1d01079c2ede"><div class="ttname"><a href="group__calc.html#ga683779343fb2c6055f6b1d01079c2ede">calcPurity</a></div><div class="ttdeci">qreal calcPurity(Qureg qureg)</div><div class="ttdoc">Calculates the purity of a density matrix, by the trace of the density matrix squared.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00936">QuEST.c:936</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a0acfe30083d0bc2a84da196378a36122"><div class="ttname"><a href="QuEST__internal_8h.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledMultiQubitUnitary(Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01437">QuEST_cpu_distributed.c:1437</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aab522b9871ea39eaf76d36850817e5bc"><div class="ttname"><a href="QuEST__validation_8c.html#aab522b9871ea39eaf76d36850817e5bc">validateHamilFilePauliParsed</a></div><div class="ttdeci">void validateHamilFilePauliParsed(int parsed, PauliHamil h, FILE *file, char *fn, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00647">QuEST_validation.c:647</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a8d88b4ed94ab024e5e7b2f1f4f505b44"><div class="ttname"><a href="QuEST__internal_8h.html#a8d88b4ed94ab024e5e7b2f1f4f505b44">statevec_multiRotateZ</a></div><div class="ttdeci">void statevec_multiRotateZ(Qureg qureg, long long int mask, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03109">QuEST_cpu.c:3109</a></div></div>
<div class="ttc" id="agroup__calc_html_ga2a7946e6fa4f44c9ae0c6c9f683229ad"><div class="ttname"><a href="group__calc.html#ga2a7946e6fa4f44c9ae0c6c9f683229ad">calcProbOfOutcome</a></div><div class="ttdeci">qreal calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdoc">Gives the probability of a specified qubit being measured in the given outcome (0 or 1).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00926">QuEST.c:926</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a6bd68fa9c0c1bd9c9f9af714ea0b8b03"><div class="ttname"><a href="QuEST__qasm_8c.html#a6bd68fa9c0c1bd9c9f9af714ea0b8b03">qasm_recordControlledCompactUnitary</a></div><div class="ttdeci">void qasm_recordControlledCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00264">QuEST_qasm.c:264</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1e8f917ab42d38d8c37ba6816b24f2f5"><div class="ttname"><a href="QuEST__internal_8h.html#a1e8f917ab42d38d8c37ba6816b24f2f5">agnostic_syncDiagonalOp</a></div><div class="ttdeci">void agnostic_syncDiagonalOp(DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01362">QuEST_cpu.c:1362</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a2a52ad9f9ad9b2fd6a76f6d433b3b217"><div class="ttname"><a href="QuEST__internal_8h.html#a2a52ad9f9ad9b2fd6a76f6d433b3b217">statevec_destroyQureg</a></div><div class="ttdeci">void statevec_destroyQureg(Qureg qureg, QuESTEnv env)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01317">QuEST_cpu.c:1317</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a63cb88a5f4eb12fef087435b8db3f8eb"><div class="ttname"><a href="QuEST__internal_8h.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a></div><div class="ttdeci">qreal statevec_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01260">QuEST_cpu_distributed.c:1260</a></div></div>
<div class="ttc" id="agroup__qasm_html_gab3a410abab3e8beb394bd3bbfae8977c"><div class="ttname"><a href="group__qasm.html#gab3a410abab3e8beb394bd3bbfae8977c">clearRecordedQASM</a></div><div class="ttdeci">void clearRecordedQASM(Qureg qureg)</div><div class="ttdoc">Clear all QASM so far recorded.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00095">QuEST.c:95</a></div></div>
<div class="ttc" id="agroup__normgate_html_ga2a3794103125f1e3cfa103f8b1963656"><div class="ttname"><a href="group__normgate.html#ga2a3794103125f1e3cfa103f8b1963656">measure</a></div><div class="ttdeci">int measure(Qureg qureg, int measureQubit)</div><div class="ttdoc">Measures a single qubit, collapsing it randomly to 0 or 1.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00758">QuEST.c:758</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa0cdc4c588d02a515a68515dd3f24d877">GATE_ROTATE_Z</a></div><div class="ttdeci">@ GATE_ROTATE_Z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00029">QuEST_qasm.h:29</a></div></div>
<div class="ttc" id="agroup__calc_html_gaa266ed6c8ae5d0d0f49e1ac50819cffc"><div class="ttname"><a href="group__calc.html#gaa266ed6c8ae5d0d0f49e1ac50819cffc">calcFidelity</a></div><div class="ttdeci">qreal calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdoc">Calculates the fidelity of qureg (a statevector or density matrix) against a reference pure state (ne...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00942">QuEST.c:942</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a23a0025b20f876844320f40fc02cdb69"><div class="ttname"><a href="QuEST__validation_8c.html#a23a0025b20f876844320f40fc02cdb69">validateHamilFilePauliCode</a></div><div class="ttdeci">void validateHamilFilePauliCode(enum pauliOpType code, PauliHamil h, FILE *file, char *fn, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00657">QuEST_validation.c:657</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga78b814256f851cac70fdf3cbf9cfc206"><div class="ttname"><a href="group__unitary.html#ga78b814256f851cac70fdf3cbf9cfc206">unitary</a></div><div class="ttdeci">void unitary(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general single-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00349">QuEST.c:349</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ae06b0f6b669c03241d0db3b9dc560da1"><div class="ttname"><a href="QuEST__validation_8c.html#ae06b0f6b669c03241d0db3b9dc560da1">validateProb</a></div><div class="ttdeci">void validateProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00515">QuEST_validation.c:515</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa228cd6a7ad18928b794ee7ad1f1fc85e">GATE_SIGMA_Z</a></div><div class="ttdeci">@ GATE_SIGMA_Z</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00023">QuEST_qasm.h:23</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a4e19ef93d01d7acea32ca646d623aedd"><div class="ttname"><a href="QuEST__internal_8h.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a></div><div class="ttdeci">void statevec_controlledPauliY(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01140">QuEST_cpu_distributed.c:1140</a></div></div>
<div class="ttc" id="agroup__decoherence_html_gacfc45a8fc86ee18f60866bbd0c874ed0"><div class="ttname"><a href="group__decoherence.html#gacfc45a8fc86ee18f60866bbd0c874ed0">mixTwoQubitDepolarising</a></div><div class="ttdeci">void mixTwoQubitDepolarising(Qureg qureg, int qubit1, int qubit2, qreal prob)</div><div class="ttdoc">Mixes a density matrix qureg to induce two-qubit homogeneous depolarising noise.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01042">QuEST.c:1042</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a99702f4667c429969d7e7b4ecd45c2f3"><div class="ttname"><a href="QuEST__common_8c.html#a99702f4667c429969d7e7b4ecd45c2f3">densmatr_mixMultiQubitKrausMap</a></div><div class="ttdeci">void densmatr_mixMultiQubitKrausMap(Qureg qureg, int *targets, int numTargets, ComplexMatrixN *ops, int numOps)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00643">QuEST_common.c:643</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_af92fa737f4491324408b3d15543dced4"><div class="ttname"><a href="QuEST__common_8c.html#af92fa737f4491324408b3d15543dced4">getConjugateScalar</a></div><div class="ttdeci">Complex getConjugateScalar(Complex scalar)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00085">QuEST_common.c:85</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a63df1ec14ff7cc81c3f392ac10fcc744"><div class="ttname"><a href="QuEST__internal_8h.html#a63df1ec14ff7cc81c3f392ac10fcc744">statevec_controlledPhaseShift</a></div><div class="ttdeci">void statevec_controlledPhaseShift(Qureg qureg, int idQubit1, int idQubit2, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03019">QuEST_cpu.c:3019</a></div></div>
<div class="ttc" id="agroup__calc_html_ga82f17e96a4cb7612fb9c6ef856df3810"><div class="ttname"><a href="group__calc.html#ga82f17e96a4cb7612fb9c6ef856df3810">calcExpecDiagonalOp</a></div><div class="ttdeci">Complex calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdoc">Computes the expected value of the diagonal operator op for state qureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00979">QuEST.c:979</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa8417e56d80add49216437e0d451e8dd9">GATE_HADAMARD</a></div><div class="ttdeci">@ GATE_HADAMARD</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00026">QuEST_qasm.h:26</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ad34d98eeaa6a3cb45e92c696cfd2d1c8"><div class="ttname"><a href="QuEST__common_8c.html#ad34d98eeaa6a3cb45e92c696cfd2d1c8">getConjugateMatrix2</a></div><div class="ttdeci">ComplexMatrix2 getConjugateMatrix2(ComplexMatrix2 src)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00099">QuEST_common.c:99</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a923906770cac0da9e3459bae58de9e64"><div class="ttname"><a href="QuEST__internal_8h.html#a923906770cac0da9e3459bae58de9e64">statevec_initStateOfSingleQubit</a></div><div class="ttdeci">void statevec_initStateOfSingleQubit(Qureg *qureg, int qubitId, int outcome)</div><div class="ttdoc">Initialise the state vector of probability amplitudes such that one qubit is set to 'outcome' and all...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01545">QuEST_cpu.c:1545</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga655ffcd4def2e127341c9488f5ca8455"><div class="ttname"><a href="group__unitary.html#ga655ffcd4def2e127341c9488f5ca8455">sGate</a></div><div class="ttdeci">void sGate(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit S gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00466">QuEST.c:466</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a84b0328814c0b17e127396cb36065108"><div class="ttname"><a href="QuEST__qasm_8c.html#a84b0328814c0b17e127396cb36065108">qasm_startRecording</a></div><div class="ttdeci">void qasm_startRecording(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00084">QuEST_qasm.c:84</a></div></div>
<div class="ttc" id="agroup__init_html_ga4534403b721977b669bff7bf4e37f0fb"><div class="ttname"><a href="group__init.html#ga4534403b721977b669bff7bf4e37f0fb">cloneQureg</a></div><div class="ttdeci">void cloneQureg(Qureg targetQureg, Qureg copyQureg)</div><div class="ttdoc">Set targetQureg to be a clone of copyQureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00165">QuEST.c:165</a></div></div>
<div class="ttc" id="astructComplexMatrix4_html"><div class="ttname"><a href="structComplexMatrix4.html">ComplexMatrix4</a></div><div class="ttdoc">Represents a 4x4 matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00125">QuEST.h:125</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga34312ff52cc28bcab3cbd2ff338fd081"><div class="ttname"><a href="group__unitary.html#ga34312ff52cc28bcab3cbd2ff338fd081">rotateY</a></div><div class="ttdeci">void rotateY(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdoc">Rotate a single qubit by a given angle around the Y-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00199">QuEST.c:199</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a20a155f53efc45c16803d7539c2c199d"><div class="ttname"><a href="QuEST__internal_8h.html#a20a155f53efc45c16803d7539c2c199d">densmatr_initClassicalState</a></div><div class="ttdeci">void densmatr_initClassicalState(Qureg qureg, long long int stateInd)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01115">QuEST_cpu.c:1115</a></div></div>
<div class="ttc" id="agroup__operator_html_ga54d4e589468002bdc998200ae45e7312"><div class="ttname"><a href="group__operator.html#ga54d4e589468002bdc998200ae45e7312">applyPauliHamil</a></div><div class="ttdeci">void applyPauliHamil(Qureg inQureg, PauliHamil hamil, Qureg outQureg)</div><div class="ttdoc">Modifies outQureg to be the result of applying PauliHamil (a Hermitian but not necessarily unitary op...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00819">QuEST.c:819</a></div></div>
<div class="ttc" id="astructQuESTEnv_html"><div class="ttname"><a href="structQuESTEnv.html">QuESTEnv</a></div><div class="ttdoc">Information about the environment the program is running in.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00242">QuEST.h:242</a></div></div>
<div class="ttc" id="aQuEST_8c_html_ae85a2c07d2f1ff2265c4bf22e17653eb"><div class="ttname"><a href="QuEST_8c.html#ae85a2c07d2f1ff2265c4bf22e17653eb">setDensityAmps</a></div><div class="ttdeci">void setDensityAmps(Qureg qureg, qreal *reals, qreal *imags)</div><div class="ttdoc">Set elements in the underlying state vector represenation of a density matrix.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00790">QuEST.c:790</a></div></div>
<div class="ttc" id="agroup__type_html_gaa77376c5e3518186eb085f37826d6008"><div class="ttname"><a href="group__type.html#gaa77376c5e3518186eb085f37826d6008">createPauliHamilFromFile</a></div><div class="ttdeci">PauliHamil createPauliHamilFromFile(char *fn)</div><div class="ttdoc">Create a PauliHamil instance, a real-weighted sum of products of Pauli operators, populated with the ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01169">QuEST.c:1169</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga0832e39058d913ad47af44e97a854446"><div class="ttname"><a href="group__unitary.html#ga0832e39058d913ad47af44e97a854446">multiControlledPhaseShift</a></div><div class="ttdeci">void multiControlledPhaseShift(Qureg qureg, int *controlQubits, int numControlQubits, qreal angle)</div><div class="ttdoc">Introduce a phase factor  on state  of the passed qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00511">QuEST.c:511</a></div></div>
<div class="ttc" id="agroup__type_html_gafabb15a6c1cf49f8ecb67e1f35c77c1e"><div class="ttname"><a href="group__type.html#gafabb15a6c1cf49f8ecb67e1f35c77c1e">setDiagonalOpElems</a></div><div class="ttdeci">void setDiagonalOpElems(DiagonalOp op, long long int startInd, qreal *real, qreal *imag, long long int numElems)</div><div class="ttdoc">Modifies a subset (starting at index startInd) of the elements in DiagonalOp op with the given elemen...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01292">QuEST.c:1292</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa662796ea6e0f471143c53becae8c12c"><div class="ttname"><a href="QuEST__internal_8h.html#aa662796ea6e0f471143c53becae8c12c">statevec_multiControlledPhaseShift</a></div><div class="ttdeci">void statevec_multiControlledPhaseShift(Qureg qureg, int *controlQubits, int numControlQubits, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03059">QuEST_cpu.c:3059</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_af1cca787f3b0e0c91ffb2495f9ad8d5a"><div class="ttname"><a href="QuEST__internal_8h.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a></div><div class="ttdeci">void statevec_pauliY(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01090">QuEST_cpu_distributed.c:1090</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html"><div class="ttname"><a href="structComplexMatrixN.html">ComplexMatrixN</a></div><div class="ttdoc">Represents a general 2^N by 2^N matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00136">QuEST.h:136</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_abedaf81fa9ed252b2f8fbd1bd73f8f8e"><div class="ttname"><a href="QuEST__validation_8c.html#abedaf81fa9ed252b2f8fbd1bd73f8f8e">validateTwoQubitDepolProb</a></div><div class="ttdeci">void validateTwoQubitDepolProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00547">QuEST_validation.c:547</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a06b8474aec51579ff680fb66439e7fc6"><div class="ttname"><a href="QuEST__common_8c.html#a06b8474aec51579ff680fb66439e7fc6">statevec_controlledMultiQubitUnitary</a></div><div class="ttdeci">void statevec_controlledMultiQubitUnitary(Qureg qureg, int ctrl, int *targets, int numTargets, ComplexMatrixN u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00535">QuEST_common.c:535</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5be128290a7bba9a7f12d32cabe2276b"><div class="ttname"><a href="QuEST__validation_8c.html#a5be128290a7bba9a7f12d32cabe2276b">validateNumPauliSumTerms</a></div><div class="ttdeci">void validateNumPauliSumTerms(int numTerms, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00570">QuEST_validation.c:570</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aeeec9fe1501e25930adf6c38763a158e"><div class="ttname"><a href="QuEST__common_8c.html#aeeec9fe1501e25930adf6c38763a158e">statevec_calcFidelity</a></div><div class="ttdeci">qreal statevec_calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00377">QuEST_common.c:377</a></div></div>
<div class="ttc" id="agroup__type_html_ga7740e349b4f8bae6451547680f0ce2d6"><div class="ttname"><a href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a></div><div class="ttdeci">#define qreal</div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6a3d99bc780707a90120a78a6e203792"><div class="ttname"><a href="QuEST__validation_8c.html#a6a3d99bc780707a90120a78a6e203792">validateMatrixInit</a></div><div class="ttdeci">void validateMatrixInit(ComplexMatrixN matr, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00450">QuEST_validation.c:450</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga34aa4865c92f9aa5d898c91286c9eca5"><div class="ttname"><a href="group__unitary.html#ga34aa4865c92f9aa5d898c91286c9eca5">multiRotatePauli</a></div><div class="ttdeci">void multiRotatePauli(Qureg qureg, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle)</div><div class="ttdoc">Apply a multi-qubit multi-Pauli rotation on a selected number of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00642">QuEST.c:642</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6b9523909701f7bd79f2ab7b56a8e6bd"><div class="ttname"><a href="QuEST__validation_8c.html#a6b9523909701f7bd79f2ab7b56a8e6bd">validateFileOpened</a></div><div class="ttdeci">void validateFileOpened(int opened, char *fn, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00507">QuEST_validation.c:507</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a9975b6f54f4090cdf851958bc2b37230"><div class="ttname"><a href="QuEST__qasm_8c.html#a9975b6f54f4090cdf851958bc2b37230">qasm_recordMultiStateControlledUnitary</a></div><div class="ttdeci">void qasm_recordMultiStateControlledUnitary(Qureg qureg, ComplexMatrix2 u, int *controlQubits, int *controlState, int numControlQubits, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00362">QuEST_qasm.c:362</a></div></div>
<div class="ttc" id="agroup__qasm_html_gabdaa339967f0955176a4967f01364182"><div class="ttname"><a href="group__qasm.html#gabdaa339967f0955176a4967f01364182">stopRecordingQASM</a></div><div class="ttdeci">void stopRecordingQASM(Qureg qureg)</div><div class="ttdoc">Disable QASM recording.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00091">QuEST.c:91</a></div></div>
<div class="ttc" id="agroup__init_html_gabc0c64f8adf307d2a44184dc0f8ca66e"><div class="ttname"><a href="group__init.html#gabc0c64f8adf307d2a44184dc0f8ca66e">setAmps</a></div><div class="ttdeci">void setAmps(Qureg qureg, long long int startInd, qreal *reals, qreal *imags, long long int numAmps)</div><div class="ttdoc">Overwrites a subset of the amplitudes in qureg, with those passed in reals and imags.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00781">QuEST.c:781</a></div></div>
<div class="ttc" id="agroup__unitary_html_gad76781842af56821ed4e223bd776f057"><div class="ttname"><a href="group__unitary.html#gad76781842af56821ed4e223bd776f057">multiControlledPhaseFlip</a></div><div class="ttdeci">void multiControlledPhaseFlip(Qureg qureg, int *controlQubits, int numControlQubits)</div><div class="ttdoc">Apply the multiple-qubit controlled phase flip gate, also known as the multiple-qubit controlled paul...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00561">QuEST.c:561</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga20bf9b8a71b8a3ee4651e9497e6d1f4f"><div class="ttname"><a href="group__unitary.html#ga20bf9b8a71b8a3ee4651e9497e6d1f4f">multiQubitUnitary</a></div><div class="ttdeci">void multiQubitUnitary(Qureg qureg, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general multi-qubit unitary (including a global phase factor) with any number of target qubit...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00297">QuEST.c:297</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a6550462400942be61b171c8840b36aa1"><div class="ttname"><a href="QuEST__common_8c.html#a6550462400942be61b171c8840b36aa1">statevec_sqrtSwapGate</a></div><div class="ttdeci">void statevec_sqrtSwapGate(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00384">QuEST_common.c:384</a></div></div>
<div class="ttc" id="agroup__calc_html_ga30d6f8b7c766c9c9914b2c61a2fc0def"><div class="ttname"><a href="group__calc.html#ga30d6f8b7c766c9c9914b2c61a2fc0def">getAmp</a></div><div class="ttdeci">Complex getAmp(Qureg qureg, long long int index)</div><div class="ttdoc">Get the complex amplitude at a given index in the state vector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00699">QuEST.c:699</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a3afe58e49dce5536bc4c1b7caddf44a6"><div class="ttname"><a href="QuEST__common_8c.html#a3afe58e49dce5536bc4c1b7caddf44a6">statevec_getProbAmp</a></div><div class="ttdeci">qreal statevec_getProbAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00245">QuEST_common.c:245</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga5e5fdaa7d3dd449b3e2c5d4a01bd015a"><div class="ttname"><a href="group__unitary.html#ga5e5fdaa7d3dd449b3e2c5d4a01bd015a">controlledPauliY</a></div><div class="ttdeci">void controlledPauliY(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdoc">Apply the controlled pauliY (single control, single target) gate, also known as the c-Y and c-sigma-Y...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00537">QuEST.c:537</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a0b84e6766bd682708e6211276ff0a5bb"><div class="ttname"><a href="QuEST__internal_8h.html#a0b84e6766bd682708e6211276ff0a5bb">agnostic_createDiagonalOp</a></div><div class="ttdeci">DiagonalOp agnostic_createDiagonalOp(int numQubits, QuESTEnv env)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01335">QuEST_cpu.c:1335</a></div></div>
<div class="ttc" id="agroup__type_html_ga429f1b90b3ef06c786dec8c7f0eda4ce"><div class="ttname"><a href="group__type.html#ga429f1b90b3ef06c786dec8c7f0eda4ce">initComplexMatrixN</a></div><div class="ttdeci">void initComplexMatrixN(ComplexMatrixN m, qreal re[][1&lt;&lt; m.numQubits], qreal im[][1&lt;&lt; m.numQubits])</div><div class="ttdoc">Initialises a ComplexMatrixN instance to have the passed real and imag values.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01136">QuEST.c:1136</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ab7478fcaf6357ab202d72853b672e375"><div class="ttname"><a href="QuEST__internal_8h.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a></div><div class="ttdeci">void statevec_swapQubitAmps(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01354">QuEST_cpu_distributed.c:1354</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a4a2fa262d3f0dba372797b9bd35d9fa5"><div class="ttname"><a href="QuEST__internal_8h.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a></div><div class="ttdeci">void statevec_controlledPauliYConj(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01173">QuEST_cpu_distributed.c:1173</a></div></div>
<div class="ttc" id="agroup__normgate_html_gae192ac0759e46c7b20a7182020155240"><div class="ttname"><a href="group__normgate.html#gae192ac0759e46c7b20a7182020155240">measureWithStats</a></div><div class="ttdeci">int measureWithStats(Qureg qureg, int measureQubit, qreal *outcomeProb)</div><div class="ttdoc">Measures a single qubit, collapsing it randomly to 0 or 1, and additionally gives the probability of ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00745">QuEST.c:745</a></div></div>
<div class="ttc" id="astructQureg_html_a0a86e8a50ea8c998b4a0a6640c5a1218"><div class="ttname"><a href="structQureg.html#a0a86e8a50ea8c998b4a0a6640c5a1218">Qureg::numQubitsInStateVec</a></div><div class="ttdeci">int numQubitsInStateVec</div><div class="ttdoc">Number of qubits in the state-vector - this is double the number represented for mixed states.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00210">QuEST.h:210</a></div></div>
<div class="ttc" id="agroup__calc_html_ga5544d2833a69941b8820797b79daf79f"><div class="ttname"><a href="group__calc.html#ga5544d2833a69941b8820797b79daf79f">calcExpecPauliHamil</a></div><div class="ttdeci">qreal calcExpecPauliHamil(Qureg qureg, PauliHamil hamil, Qureg workspace)</div><div class="ttdoc">Computes the expected value of qureg under Hermitian operator hamil.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00970">QuEST.c:970</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a782c6f57939eeb72b7be8e247979f3be"><div class="ttname"><a href="QuEST__validation_8c.html#a782c6f57939eeb72b7be8e247979f3be">validateVector</a></div><div class="ttdeci">void validateVector(Vector vec, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00475">QuEST_validation.c:475</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga3ad6c477edcdbc845fc1143e860fda08"><div class="ttname"><a href="group__unitary.html#ga3ad6c477edcdbc845fc1143e860fda08">multiControlledMultiQubitUnitary</a></div><div class="ttdeci">void multiControlledMultiQubitUnitary(Qureg qureg, int *ctrls, int numCtrls, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general multi-controlled multi-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00331">QuEST.c:331</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a6153547f245c05874161a105e9a2f02c"><div class="ttname"><a href="QuEST__internal_8h.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a></div><div class="ttdeci">qreal densmatr_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00053">QuEST_cpu_distributed.c:53</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga8886a3793b21622c48cf3bad6e15082d"><div class="ttname"><a href="group__unitary.html#ga8886a3793b21622c48cf3bad6e15082d">rotateX</a></div><div class="ttdeci">void rotateX(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdoc">Rotate a single qubit by a given angle around the X-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00188">QuEST.c:188</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a9e7e85cfc36e3ce1f456a840a217bfd9"><div class="ttname"><a href="QuEST__validation_8c.html#a9e7e85cfc36e3ce1f456a840a217bfd9">validateMultiQubits</a></div><div class="ttdeci">void validateMultiQubits(Qureg qureg, int *qubits, int numQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00408">QuEST_validation.c:408</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a5658f2ecbbd4ea425db5f7dc7fc4ba92"><div class="ttname"><a href="QuEST__internal_8h.html#a5658f2ecbbd4ea425db5f7dc7fc4ba92">densmatr_collapseToKnownProbOutcome</a></div><div class="ttdeci">void densmatr_collapseToKnownProbOutcome(Qureg qureg, int measureQubit, int outcome, qreal outcomeProb)</div><div class="ttdoc">Renorms (/prob) every | * outcome * &gt;&lt; * outcome * | state, setting all others to zero.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00785">QuEST_cpu.c:785</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_add9ca9956cdd81ed5d0b0f66168c04a3"><div class="ttname"><a href="QuEST__internal_8h.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a></div><div class="ttdeci">void statevec_controlledUnitary(Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00958">QuEST_cpu_distributed.c:958</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a0fb948ddab4ca210e523aa3c52639df4"><div class="ttname"><a href="QuEST__internal_8h.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex statevec_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01523">QuEST_cpu_distributed.c:1523</a></div></div>
<div class="ttc" id="agroup__init_html_ga5d0f3f71ea38d3c44597f8c2c2f014d4"><div class="ttname"><a href="group__init.html#ga5d0f3f71ea38d3c44597f8c2c2f014d4">setWeightedQureg</a></div><div class="ttdeci">void setWeightedQureg(Complex fac1, Qureg qureg1, Complex fac2, Qureg qureg2, Complex facOut, Qureg out)</div><div class="ttdoc">Modifies qureg out to the result of (facOut out + fac1 qureg1 + fac2 qureg2), imposing no constraints...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00797">QuEST.c:797</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_aa4c380db9eda18892d5a86825fa4b165"><div class="ttname"><a href="QuEST__qasm_8c.html#aa4c380db9eda18892d5a86825fa4b165">qasm_recordControlledGate</a></div><div class="ttdeci">void qasm_recordControlledGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00238">QuEST_qasm.c:238</a></div></div>
<div class="ttc" id="agroup__calc_html_ga87ddbe5c8281543541ccd99e0dafd387"><div class="ttname"><a href="group__calc.html#ga87ddbe5c8281543541ccd99e0dafd387">calcHilbertSchmidtDistance</a></div><div class="ttdeci">qreal calcHilbertSchmidtDistance(Qureg a, Qureg b)</div><div class="ttdoc">Computes the Hilbert Schmidt distance between two density matrices a and b, defined as the Frobenius ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00988">QuEST.c:988</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aefc4a3a9cdb71f6e63bc58ad600e420e"><div class="ttname"><a href="QuEST__validation_8c.html#aefc4a3a9cdb71f6e63bc58ad600e420e">validateControlTarget</a></div><div class="ttdeci">void validateControlTarget(Qureg qureg, int controlQubit, int targetQubit, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00372">QuEST_validation.c:372</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a42607270d63948acf84d6def787213e8"><div class="ttname"><a href="QuEST__qasm_8c.html#a42607270d63948acf84d6def787213e8">qasm_recordAxisRotation</a></div><div class="ttdeci">void qasm_recordAxisRotation(Qureg qureg, qreal angle, Vector axis, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00223">QuEST_qasm.c:223</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a8a656a83bf0b44447188d06c2f8114cb"><div class="ttname"><a href="QuEST__validation_8c.html#a8a656a83bf0b44447188d06c2f8114cb">validateDiagonalOp</a></div><div class="ttdeci">void validateDiagonalOp(Qureg qureg, DiagonalOp op, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00677">QuEST_validation.c:677</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a8adaba9dbdad6f7ab41ae4b8db0abefe"><div class="ttname"><a href="QuEST__internal_8h.html#a8adaba9dbdad6f7ab41ae4b8db0abefe">densmatr_mixDensityMatrix</a></div><div class="ttdeci">void densmatr_mixDensityMatrix(Qureg combineQureg, qreal otherProb, Qureg otherQureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00890">QuEST_cpu.c:890</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab656861dfb036cbcf7009f02a8949253">GATE_SQRT_SWAP</a></div><div class="ttdeci">@ GATE_SQRT_SWAP</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00034">QuEST_qasm.h:34</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga5d80b490e3910aa737a81bb597cdfcc9"><div class="ttname"><a href="group__unitary.html#ga5d80b490e3910aa737a81bb597cdfcc9">pauliZ</a></div><div class="ttdeci">void pauliZ(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit Pauli-Z (also known as the Z, sigma-Z or phase-flip) gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00455">QuEST.c:455</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa13c9487aed515148e7594e35eb8dcc55">GATE_SIGMA_X</a></div><div class="ttdeci">@ GATE_SIGMA_X</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00021">QuEST_qasm.h:21</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a0befde437a58ef8fe38495bfc2a16f0e"><div class="ttname"><a href="QuEST__qasm_8c.html#a0befde437a58ef8fe38495bfc2a16f0e">qasm_recordMeasurement</a></div><div class="ttdeci">void qasm_recordMeasurement(Qureg qureg, int measureQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00398">QuEST_qasm.c:398</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a77ad622c5ba852708a80755ac1792288"><div class="ttname"><a href="QuEST__qasm_8c.html#a77ad622c5ba852708a80755ac1792288">qasm_stopRecording</a></div><div class="ttdeci">void qasm_stopRecording(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00088">QuEST_qasm.c:88</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a2ca0c6ba07ab2b4b437321bf17efc966"><div class="ttname"><a href="QuEST__internal_8h.html#a2ca0c6ba07ab2b4b437321bf17efc966">statevec_initZeroState</a></div><div class="ttdeci">void statevec_initZeroState(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01428">QuEST_cpu.c:1428</a></div></div>
<div class="ttc" id="agroup__operator_html_gad2e953390342cd361cfb4064d47715e6"><div class="ttname"><a href="group__operator.html#gad2e953390342cd361cfb4064d47715e6">applyDiagonalOp</a></div><div class="ttdeci">void applyDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdoc">Apply a diagonal complex operator, which is possibly non-unitary and non-Hermitian,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00887">QuEST.c:887</a></div></div>
<div class="ttc" id="astructPauliHamil_html_ac1c6c9f6299cf83bbba88123216c3cac"><div class="ttname"><a href="structPauliHamil.html#ac1c6c9f6299cf83bbba88123216c3cac">PauliHamil::termCoeffs</a></div><div class="ttdeci">qreal * termCoeffs</div><div class="ttdoc">The coefficient of each Pauli product. This is a length numSumTerms array.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00164">QuEST.h:164</a></div></div>
<div class="ttc" id="agroup__operator_html_ga74a955ec4bce606d89317bcfc528387f"><div class="ttname"><a href="group__operator.html#ga74a955ec4bce606d89317bcfc528387f">applyMatrix4</a></div><div class="ttdeci">void applyMatrix4(Qureg qureg, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">Apply a general 4-by-4 matrix, which may be non-unitary.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00853">QuEST.c:853</a></div></div>
<div class="ttc" id="aQuEST_8c_html_a7ba64480d4c3f7b1c3ea90cc0245f3e8"><div class="ttname"><a href="QuEST_8c.html#a7ba64480d4c3f7b1c3ea90cc0245f3e8">initStateOfSingleQubit</a></div><div class="ttdeci">void initStateOfSingleQubit(Qureg *qureg, int qubitId, int outcome)</div><div class="ttdoc">Initialise the state vector of probability amplitudes such that one qubit is set to 'outcome' and all...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01317">QuEST.c:1317</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a8a8e789585651f90fcc587042d4cdfb8"><div class="ttname"><a href="QuEST__common_8c.html#a8a8e789585651f90fcc587042d4cdfb8">agnostic_applyTrotterCircuit</a></div><div class="ttdeci">void agnostic_applyTrotterCircuit(Qureg qureg, PauliHamil hamil, qreal time, int order, int reps)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00773">QuEST_common.c:773</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa31f0ef43a921c3ac73545d1d3670fa1"><div class="ttname"><a href="QuEST__internal_8h.html#aa31f0ef43a921c3ac73545d1d3670fa1">densmatr_mixDephasing</a></div><div class="ttdeci">void densmatr_mixDephasing(Qureg qureg, int targetQubit, qreal dephase)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00079">QuEST_cpu.c:79</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aef4d89ae4b8a8b4f414ebd03ef4c6acf"><div class="ttname"><a href="QuEST__validation_8c.html#aef4d89ae4b8a8b4f414ebd03ef4c6acf">validateOneQubitDephaseProb</a></div><div class="ttdeci">void validateOneQubitDephaseProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00527">QuEST_validation.c:527</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga820fd139c035136819e371308c206e36"><div class="ttname"><a href="group__unitary.html#ga820fd139c035136819e371308c206e36">swapGate</a></div><div class="ttdeci">void swapGate(Qureg qureg, int qb1, int qb2)</div><div class="ttdoc">Performs a SWAP gate between qubit1 and qubit2.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00601">QuEST.c:601</a></div></div>
<div class="ttc" id="astructPauliHamil_html_a4b8d38c403553c07ceddcd40c46ce6c8"><div class="ttname"><a href="structPauliHamil.html#a4b8d38c403553c07ceddcd40c46ce6c8">PauliHamil::pauliCodes</a></div><div class="ttdeci">enum pauliOpType * pauliCodes</div><div class="ttdoc">The Pauli operators acting on each qubit, flattened over every operator.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00162">QuEST.h:162</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2d96b4601cc3a9e1221e11a366fe1699"><div class="ttname"><a href="QuEST__common_8c.html#a2d96b4601cc3a9e1221e11a366fe1699">statevec_tGate</a></div><div class="ttdeci">void statevec_tGate(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00272">QuEST_common.c:272</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a758bad4237ff0bf3b4ff5be626a982ae"><div class="ttname"><a href="QuEST__internal_8h.html#a758bad4237ff0bf3b4ff5be626a982ae">statevec_initBlankState</a></div><div class="ttdeci">void statevec_initBlankState(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01398">QuEST_cpu.c:1398</a></div></div>
<div class="ttc" id="agroup__init_html_ga4589960486ec43dcd63bd985f1c4f398"><div class="ttname"><a href="group__init.html#ga4589960486ec43dcd63bd985f1c4f398">initStateFromAmps</a></div><div class="ttdeci">void initStateFromAmps(Qureg qureg, qreal *reals, qreal *imags)</div><div class="ttdoc">Initialise qureg by specifying the complete statevector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00157">QuEST.c:157</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1e57230c7995447039e62a84c0a36524"><div class="ttname"><a href="QuEST__internal_8h.html#a1e57230c7995447039e62a84c0a36524">statevec_reportStateToScreen</a></div><div class="ttdeci">void statevec_reportStateToScreen(Qureg qureg, QuESTEnv env, int reportRank)</div><div class="ttdoc">Print the current state vector of probability amplitudes for a set of qubits to standard out.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01366">QuEST_cpu.c:1366</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a0bd6443ea0f5e36738f3b39b72080b6e"><div class="ttname"><a href="QuEST__validation_8c.html#a0bd6443ea0f5e36738f3b39b72080b6e">validateControlState</a></div><div class="ttdeci">void validateControlState(int *controlState, int numControlQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00432">QuEST_validation.c:432</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a27294e3065ebe42a65b3b9e0f85551dd"><div class="ttname"><a href="QuEST__internal_8h.html#a27294e3065ebe42a65b3b9e0f85551dd">statevec_applyDiagonalOp</a></div><div class="ttdeci">void statevec_applyDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03661">QuEST_cpu.c:3661</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a6776217a5f7ba38b56175cf6db0f96e0"><div class="ttname"><a href="QuEST__validation_8c.html#a6776217a5f7ba38b56175cf6db0f96e0">validateMultiTargets</a></div><div class="ttdeci">void validateMultiTargets(Qureg qureg, int *targetQubits, int numTargetQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00392">QuEST_validation.c:392</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a55d0f243437a0bb3b7609a1090323aa3"><div class="ttname"><a href="QuEST__qasm_8c.html#a55d0f243437a0bb3b7609a1090323aa3">qasm_recordInitClassical</a></div><div class="ttdeci">void qasm_recordInitClassical(Qureg qureg, long long int stateInd)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00458">QuEST_qasm.c:458</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa121d55f2ca09c06a96ddcd433c60b0f"><div class="ttname"><a href="QuEST__internal_8h.html#aa121d55f2ca09c06a96ddcd433c60b0f">statevec_setAmps</a></div><div class="ttdeci">void statevec_setAmps(Qureg qureg, long long int startInd, qreal *reals, qreal *imags, long long int numAmps)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01237">QuEST_cpu.c:1237</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a39aeacb22460bd1430129795761ade28"><div class="ttname"><a href="QuEST__qasm_8c.html#a39aeacb22460bd1430129795761ade28">qasm_writeRecordedToFile</a></div><div class="ttdeci">int qasm_writeRecordedToFile(Qureg qureg, char *filename)</div><div class="ttdoc">returns success of file write</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00489">QuEST_qasm.c:489</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_ae776148507b8f769cd00d1603212a028"><div class="ttname"><a href="QuEST__qasm_8c.html#ae776148507b8f769cd00d1603212a028">qasm_recordControlledParamGate</a></div><div class="ttdeci">void qasm_recordControlledParamGate(Qureg qureg, TargetGate gate, int controlQubit, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00247">QuEST_qasm.c:247</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa4b77089145184d990848cd66993aa8b"><div class="ttname"><a href="QuEST__internal_8h.html#aa4b77089145184d990848cd66993aa8b">statevec_cloneQureg</a></div><div class="ttdeci">void statevec_cloneQureg(Qureg targetQureg, Qureg copyQureg)</div><div class="ttdoc">works for both statevectors and density matrices</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01506">QuEST_cpu.c:1506</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_adf5fbea75826cde7d86fd7c31bcf3dec"><div class="ttname"><a href="QuEST__common_8c.html#adf5fbea75826cde7d86fd7c31bcf3dec">statevec_rotateAroundAxis</a></div><div class="ttdeci">void statevec_rotateAroundAxis(Qureg qureg, int rotQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00311">QuEST_common.c:311</a></div></div>
<div class="ttc" id="agroup__qasm_html_ga0054955857ce83b88e127d731796c23d"><div class="ttname"><a href="group__qasm.html#ga0054955857ce83b88e127d731796c23d">writeRecordedQASMToFile</a></div><div class="ttdeci">void writeRecordedQASMToFile(Qureg qureg, char *filename)</div><div class="ttdoc">Writes recorded QASM to a file, throwing an error if inaccessible.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00103">QuEST.c:103</a></div></div>
<div class="ttc" id="astructQuESTEnv_html_af22aacd7c9905accae28484785c193b4"><div class="ttname"><a href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">QuESTEnv::numRanks</a></div><div class="ttdeci">int numRanks</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00245">QuEST.h:245</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a623e577b7230f3c8dc202be6185b4289"><div class="ttname"><a href="QuEST__internal_8h.html#a623e577b7230f3c8dc202be6185b4289">densmatr_mixTwoQubitDephasing</a></div><div class="ttdeci">void densmatr_mixTwoQubitDephasing(Qureg qureg, int qubit1, int qubit2, qreal dephase)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00084">QuEST_cpu.c:84</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a9fd917537204e074119d4f283dea78e3"><div class="ttname"><a href="QuEST__common_8c.html#a9fd917537204e074119d4f283dea78e3">setConjugateMatrixN</a></div><div class="ttdeci">void setConjugateMatrixN(ComplexMatrixN m)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00109">QuEST_common.c:109</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a87d22240ccfd81827a2a34b8d569d347"><div class="ttname"><a href="QuEST__validation_8c.html#a87d22240ccfd81827a2a34b8d569d347">validateMatchingQuregDims</a></div><div class="ttdeci">void validateMatchingQuregDims(Qureg qureg1, Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00495">QuEST_validation.c:495</a></div></div>
<div class="ttc" id="agroup__calc_html_ga1416145280c62c5dd5ec9bed89b4cd05"><div class="ttname"><a href="group__calc.html#ga1416145280c62c5dd5ec9bed89b4cd05">getRealAmp</a></div><div class="ttdeci">qreal getRealAmp(Qureg qureg, long long int index)</div><div class="ttdoc">Get the real component of the complex probability amplitude at an index in the state vector.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00678">QuEST.c:678</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga2fa310101ecffd6aeba96f77b7d85f56"><div class="ttname"><a href="group__unitary.html#ga2fa310101ecffd6aeba96f77b7d85f56">controlledPhaseFlip</a></div><div class="ttdeci">void controlledPhaseFlip(Qureg qureg, int idQubit1, int idQubit2)</div><div class="ttdoc">Apply the (two-qubit) controlled phase flip gate, also known as the controlled pauliZ gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00549">QuEST.c:549</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ab004038b5f906ea897621c88bf213129"><div class="ttname"><a href="QuEST__common_8c.html#ab004038b5f906ea897621c88bf213129">densmatr_mixTwoQubitKrausMap</a></div><div class="ttdeci">void densmatr_mixTwoQubitKrausMap(Qureg qureg, int target1, int target2, ComplexMatrix4 *ops, int numOps)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00635">QuEST_common.c:635</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a3eadcb581f2623e21e4967f791d0439c"><div class="ttname"><a href="QuEST__internal_8h.html#a3eadcb581f2623e21e4967f791d0439c">statevec_multiControlledTwoQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledTwoQubitUnitary(Qureg qureg, long long int ctrlMask, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01381">QuEST_cpu_distributed.c:1381</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a482fc361fd5f08075404c72e536316a0"><div class="ttname"><a href="QuEST__internal_8h.html#a482fc361fd5f08075404c72e536316a0">statevec_initPlusState</a></div><div class="ttdeci">void statevec_initPlusState(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01438">QuEST_cpu.c:1438</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a33be8162c9633bb8015f06b38cf70735"><div class="ttname"><a href="QuEST__qasm_8c.html#a33be8162c9633bb8015f06b38cf70735">qasm_recordControlledAxisRotation</a></div><div class="ttdeci">void qasm_recordControlledAxisRotation(Qureg qureg, qreal angle, Vector axis, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00300">QuEST_qasm.c:300</a></div></div>
<div class="ttc" id="astructDiagonalOp_html_a5131eeb67aafb4c19ac98270c3266742"><div class="ttname"><a href="structDiagonalOp.html#a5131eeb67aafb4c19ac98270c3266742">DiagonalOp::numQubits</a></div><div class="ttdeci">int numQubits</div><div class="ttdoc">The number of qubits this operator can act on (informing its size)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00181">QuEST.h:181</a></div></div>
<div class="ttc" id="astructPauliHamil_html_a737e46b40ef8990cf004d22eb9dbe2e4"><div class="ttname"><a href="structPauliHamil.html#a737e46b40ef8990cf004d22eb9dbe2e4">PauliHamil::numSumTerms</a></div><div class="ttdeci">int numSumTerms</div><div class="ttdoc">The number of terms in the weighted sum, or the number of Pauli products.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00166">QuEST.h:166</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_acc45bb8300922ea5933e294921e25ea2"><div class="ttname"><a href="QuEST__common_8c.html#acc45bb8300922ea5933e294921e25ea2">getQubitBitMask</a></div><div class="ttdeci">long long int getQubitBitMask(int *qubits, int numQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00044">QuEST_common.c:44</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aec63559e8b9ab0e17efe18d64d2ceca6"><div class="ttname"><a href="QuEST__internal_8h.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a></div><div class="ttdeci">void statevec_compactUnitary(Qureg qureg, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00844">QuEST_cpu_distributed.c:844</a></div></div>
<div class="ttc" id="astructDiagonalOp_html"><div class="ttname"><a href="structDiagonalOp.html">DiagonalOp</a></div><div class="ttdoc">Represents a diagonal complex operator on the full Hilbert state of a Qureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00178">QuEST.h:178</a></div></div>
<div class="ttc" id="astructPauliHamil_html"><div class="ttname"><a href="structPauliHamil.html">PauliHamil</a></div><div class="ttdoc">Represents a weighted sum of pauli products.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00158">QuEST.h:158</a></div></div>
<div class="ttc" id="agroup__calc_html_ga73036c778d800703585ab3d8796a915f"><div class="ttname"><a href="group__calc.html#ga73036c778d800703585ab3d8796a915f">getNumQubits</a></div><div class="ttdeci">int getNumQubits(Qureg qureg)</div><div class="ttdoc">Get the number of qubits in a qureg object.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00668">QuEST.c:668</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a1c52594c03d2c136993b27f4dd315c11"><div class="ttname"><a href="QuEST__validation_8c.html#a1c52594c03d2c136993b27f4dd315c11">validateNumElems</a></div><div class="ttdeci">void validateNumElems(DiagonalOp op, long long int startInd, long long int numElems, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00357">QuEST_validation.c:357</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ac501fe7b9d331be48359ce1546348f97"><div class="ttname"><a href="QuEST__internal_8h.html#ac501fe7b9d331be48359ce1546348f97">densmatr_mixDamping</a></div><div class="ttdeci">void densmatr_mixDamping(Qureg qureg, int targetQubit, qreal damping)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00725">QuEST_cpu_distributed.c:725</a></div></div>
<div class="ttc" id="agroup__calc_html_ga374ad70804998394ae41ebfe106258a6"><div class="ttname"><a href="group__calc.html#ga374ad70804998394ae41ebfe106258a6">calcInnerProduct</a></div><div class="ttdeci">Complex calcInnerProduct(Qureg bra, Qureg ket)</div><div class="ttdoc">Computes the inner product  of two equal-size state vectors, given by.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00910">QuEST.c:910</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2153d8611247dd3a2ef483355265cc99"><div class="ttname"><a href="QuEST__common_8c.html#a2153d8611247dd3a2ef483355265cc99">statevec_multiRotatePauli</a></div><div class="ttdeci">void statevec_multiRotatePauli(Qureg qureg, int *targetQubits, enum pauliOpType *targetPaulis, int numTargets, qreal angle, int applyConj)</div><div class="ttdoc">applyConj=1 will apply conjugate operation, else applyConj=0</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00411">QuEST_common.c:411</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ac4ee5979d475e8c729294b8ef7e0270d"><div class="ttname"><a href="QuEST__internal_8h.html#ac4ee5979d475e8c729294b8ef7e0270d">statevec_multiControlledPhaseFlip</a></div><div class="ttdeci">void statevec_multiControlledPhaseFlip(Qureg qureg, int *controlQubits, int numControlQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03331">QuEST_cpu.c:3331</a></div></div>
<div class="ttc" id="agroup__type_html_ga8e1e6ad3254892edc2ee08712ea9d692"><div class="ttname"><a href="group__type.html#ga8e1e6ad3254892edc2ee08712ea9d692">destroyQureg</a></div><div class="ttdeci">void destroyQureg(Qureg qureg, QuESTEnv env)</div><div class="ttdoc">Deallocate a Qureg object representing a set of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00077">QuEST.c:77</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a2d43dbc8bf59a58b0ba9da31a8b7db8b"><div class="ttname"><a href="QuEST__validation_8c.html#a2d43dbc8bf59a58b0ba9da31a8b7db8b">validateOneQubitKrausMap</a></div><div class="ttdeci">void validateOneQubitKrausMap(Qureg qureg, ComplexMatrix2 *ops, int numOps, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00574">QuEST_validation.c:574</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a9a385fde708958617bbeb599064b8dcb"><div class="ttname"><a href="QuEST__qasm_8c.html#a9a385fde708958617bbeb599064b8dcb">qasm_recordComment</a></div><div class="ttdeci">void qasm_recordComment(Qureg qureg, char *comment,...)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00120">QuEST_qasm.c:120</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a70e3b0a2297c186d5c779af31459b4ca"><div class="ttname"><a href="QuEST__internal_8h.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex densmatr_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01541">QuEST_cpu_distributed.c:1541</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaeb975903209000ebbaf50ef1cc353a79"><div class="ttname"><a href="group__unitary.html#gaeb975903209000ebbaf50ef1cc353a79">controlledMultiQubitUnitary</a></div><div class="ttdeci">void controlledMultiQubitUnitary(Qureg qureg, int ctrl, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general controlled multi-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00314">QuEST.c:314</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a43afa97e300b87bce7f3eb1213eb05f6"><div class="ttname"><a href="QuEST__internal_8h.html#a43afa97e300b87bce7f3eb1213eb05f6">densmatr_mixTwoQubitDepolarising</a></div><div class="ttdeci">void densmatr_mixTwoQubitDepolarising(Qureg qureg, int qubit1, int qubit2, qreal depolLevel)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00752">QuEST_cpu_distributed.c:752</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a7a76950824f17e821415070a4bfdad5b"><div class="ttname"><a href="QuEST__common_8c.html#a7a76950824f17e821415070a4bfdad5b">statevec_multiQubitUnitary</a></div><div class="ttdeci">void statevec_multiQubitUnitary(Qureg qureg, int *targets, int numTargets, ComplexMatrixN u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00529">QuEST_common.c:529</a></div></div>
<div class="ttc" id="agroup__decoherence_html_ga2cf7dece0efea4207349f872cdcb7e81"><div class="ttname"><a href="group__decoherence.html#ga2cf7dece0efea4207349f872cdcb7e81">mixTwoQubitKrausMap</a></div><div class="ttdeci">void mixTwoQubitKrausMap(Qureg qureg, int target1, int target2, ComplexMatrix4 *ops, int numOps)</div><div class="ttdoc">Apply a general two-qubit Kraus map to a density matrix, as specified by at most sixteen Kraus operat...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01075">QuEST.c:1075</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html_a446e8a077597e4f76049d547df0c9738"><div class="ttname"><a href="structComplexMatrixN.html#a446e8a077597e4f76049d547df0c9738">ComplexMatrixN::real</a></div><div class="ttdeci">qreal ** real</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00139">QuEST.h:139</a></div></div>
<div class="ttc" id="agroup__debug_html_gaa696c94112e5fbbc996af10dfc4e2c1c"><div class="ttname"><a href="group__debug.html#gaa696c94112e5fbbc996af10dfc4e2c1c">initDebugState</a></div><div class="ttdeci">void initDebugState(Qureg qureg)</div><div class="ttdoc">Initialises qureg to be in the un-normalised, non-physical state with with n-th complex amplitude (2n...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01308">QuEST.c:1308</a></div></div>
<div class="ttc" id="aQuEST_8c_html_a6456bc310db1989c5b17febdb23c2c93"><div class="ttname"><a href="QuEST_8c.html#a6456bc310db1989c5b17febdb23c2c93">initStateFromSingleFile</a></div><div class="ttdeci">void initStateFromSingleFile(Qureg *qureg, char filename[200], QuESTEnv env)</div><div class="ttdoc">Initialises the wavefunction amplitudes according to those specified in a file.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01312">QuEST.c:1312</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a336c3286d2434fc892ebe20e9fa22a24"><div class="ttname"><a href="QuEST__common_8c.html#a336c3286d2434fc892ebe20e9fa22a24">statevec_controlledRotateAroundAxis</a></div><div class="ttdeci">void statevec_controlledRotateAroundAxis(Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00327">QuEST_common.c:327</a></div></div>
<div class="ttc" id="agroup__qasm_html_ga65bf1906298ca6355e2942f4923d77b6"><div class="ttname"><a href="group__qasm.html#ga65bf1906298ca6355e2942f4923d77b6">startRecordingQASM</a></div><div class="ttdeci">void startRecordingQASM(Qureg qureg)</div><div class="ttdoc">Enable QASM recording.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00087">QuEST.c:87</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_af71c2470694795a8d639be8ff9c34ed5"><div class="ttname"><a href="QuEST__common_8c.html#af71c2470694795a8d639be8ff9c34ed5">statevec_applyPauliSum</a></div><div class="ttdeci">void statevec_applyPauliSum(Qureg inQureg, enum pauliOpType *allCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00494">QuEST_common.c:494</a></div></div>
<div class="ttc" id="agroup__operator_html_ga6fc26cf857db070e12959e59ecfed8a6"><div class="ttname"><a href="group__operator.html#ga6fc26cf857db070e12959e59ecfed8a6">applyPauliSum</a></div><div class="ttdeci">void applyPauliSum(Qureg inQureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg outQureg)</div><div class="ttdoc">Modifies outQureg to be the result of applying the weighted sum of Pauli products (a Hermitian but no...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00808">QuEST.c:808</a></div></div>
<div class="ttc" id="agroup__operator_html_ga358e7094a98851afa86d27f0147e32a1"><div class="ttname"><a href="group__operator.html#ga358e7094a98851afa86d27f0147e32a1">applyMatrixN</a></div><div class="ttdeci">void applyMatrixN(Qureg qureg, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">Apply a general N-by-N matrix, which may be non-unitary, on any number of target qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00863">QuEST.c:863</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a7ebd3198a198f4cd20840f64fd8b84d0"><div class="ttname"><a href="QuEST__internal_8h.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a></div><div class="ttdeci">Complex statevec_calcInnerProduct(Qureg bra, Qureg ket)</div><div class="ttdoc">Terrible code which unnecessarily individually computes and sums the real and imaginary components of...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00035">QuEST_cpu_distributed.c:35</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2cbfe9f416d4d8acb56213841f62cb53"><div class="ttname"><a href="QuEST__common_8c.html#a2cbfe9f416d4d8acb56213841f62cb53">statevec_rotateAroundAxisConj</a></div><div class="ttdeci">void statevec_rotateAroundAxisConj(Qureg qureg, int rotQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00318">QuEST_common.c:318</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a142b424d903dfaca7a7ac166076f543a"><div class="ttname"><a href="QuEST__common_8c.html#a142b424d903dfaca7a7ac166076f543a">statevec_sGateConj</a></div><div class="ttdeci">void statevec_sGateConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00279">QuEST_common.c:279</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaefaa7acba90373efe4e0f0b94987c734"><div class="ttname"><a href="group__unitary.html#gaefaa7acba90373efe4e0f0b94987c734">compactUnitary</a></div><div class="ttdeci">void compactUnitary(Qureg qureg, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdoc">Apply a single-qubit unitary parameterised by two given complex scalars.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00405">QuEST.c:405</a></div></div>
<div class="ttc" id="agroup__init_html_ga0379e21efca0767a22607fc0e26a5a22"><div class="ttname"><a href="group__init.html#ga0379e21efca0767a22607fc0e26a5a22">initClassicalState</a></div><div class="ttdeci">void initClassicalState(Qureg qureg, long long int stateInd)</div><div class="ttdoc">Initialise a set of  qubits to the classical state (also known as a &quot;computational basis state&quot;) with...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00134">QuEST.c:134</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a269b2f7ee5c4376ae633cd2b77a7be38"><div class="ttname"><a href="QuEST__validation_8c.html#a269b2f7ee5c4376ae633cd2b77a7be38">validateOneQubitDepolProb</a></div><div class="ttdeci">void validateOneQubitDepolProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00537">QuEST_validation.c:537</a></div></div>
<div class="ttc" id="aQuEST_8c_html_acd34ae4aa7e7f466316cc104532c85c1"><div class="ttname"><a href="QuEST_8c.html#acd34ae4aa7e7f466316cc104532c85c1">getQuEST_PREC</a></div><div class="ttdeci">int getQuEST_PREC(void)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01339">QuEST.c:1339</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ad64a23933361fafc1b6b1787759c2663"><div class="ttname"><a href="QuEST__internal_8h.html#ad64a23933361fafc1b6b1787759c2663">statevec_setWeightedQureg</a></div><div class="ttdeci">void statevec_setWeightedQureg(Complex fac1, Qureg qureg1, Complex fac2, Qureg qureg2, Complex facOut, Qureg out)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03619">QuEST_cpu.c:3619</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a008becc4a18f868340836e0ab9fd6df6"><div class="ttname"><a href="QuEST__internal_8h.html#a008becc4a18f868340836e0ab9fd6df6">statevec_collapseToKnownProbOutcome</a></div><div class="ttdeci">void statevec_collapseToKnownProbOutcome(Qureg qureg, int measureQubit, int outcome, qreal outcomeProb)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01298">QuEST_cpu_distributed.c:1298</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ad0f5b8fe9cf31ef3a565e722966a5511"><div class="ttname"><a href="QuEST__validation_8c.html#ad0f5b8fe9cf31ef3a565e722966a5511">validateTwoQubitKrausMap</a></div><div class="ttdeci">void validateTwoQubitKrausMap(Qureg qureg, ComplexMatrix4 *ops, int numOps, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00586">QuEST_validation.c:586</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga8e0f03e745778a89d6f59c3c25e32df8"><div class="ttname"><a href="group__unitary.html#ga8e0f03e745778a89d6f59c3c25e32df8">pauliY</a></div><div class="ttdeci">void pauliY(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit Pauli-Y (also known as the Y or sigma-Y) gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00444">QuEST.c:444</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a6fa6f1bc617e9fef3cd87ecc3677a02b"><div class="ttname"><a href="QuEST__common_8c.html#a6fa6f1bc617e9fef3cd87ecc3677a02b">getControlFlipMask</a></div><div class="ttdeci">long long int getControlFlipMask(int *controlQubits, int *controlState, int numControlQubits)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00054">QuEST_common.c:54</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a3a79e4305d35f1756b8438bbd34ea6cc"><div class="ttname"><a href="QuEST__qasm_8c.html#a3a79e4305d35f1756b8438bbd34ea6cc">qasm_recordMultiControlledUnitary</a></div><div class="ttdeci">void qasm_recordMultiControlledUnitary(Qureg qureg, ComplexMatrix2 u, int *controlQubits, int numControlQubits, int targetQubit)</div><div class="ttdoc">additionally performs Rz on target to restore the global phase lost from u in QASM U(a,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00341">QuEST_qasm.c:341</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abd509244d57657e148e4084c5ab5d28f"><div class="ttname"><a href="QuEST__internal_8h.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a></div><div class="ttdeci">qreal statevec_getImagAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00208">QuEST_cpu_distributed.c:208</a></div></div>
<div class="ttc" id="astructQureg_html"><div class="ttname"><a href="structQureg.html">Qureg</a></div><div class="ttdoc">Represents a system of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00203">QuEST.h:203</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a1445a08d034806627cc0b5aa0f4f6d3a"><div class="ttname"><a href="QuEST__qasm_8c.html#a1445a08d034806627cc0b5aa0f4f6d3a">qasm_recordMultiControlledParamGate</a></div><div class="ttdeci">void qasm_recordMultiControlledParamGate(Qureg qureg, TargetGate gate, int *controlQubits, int numControlQubits, int targetQubit, qreal param)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00324">QuEST_qasm.c:324</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga7214a79aa22ae7a50ad6f38615968cb0"><div class="ttname"><a href="group__unitary.html#ga7214a79aa22ae7a50ad6f38615968cb0">controlledPhaseShift</a></div><div class="ttdeci">void controlledPhaseShift(Qureg qureg, int idQubit1, int idQubit2, qreal angle)</div><div class="ttdoc">Introduce a phase factor  on state  of qubits idQubit1 and idQubit2.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00499">QuEST.c:499</a></div></div>
<div class="ttc" id="agroup__decoherence_html_ga14282bdb1dc65760ca9ecbe6305eb770"><div class="ttname"><a href="group__decoherence.html#ga14282bdb1dc65760ca9ecbe6305eb770">mixTwoQubitDephasing</a></div><div class="ttdeci">void mixTwoQubitDephasing(Qureg qureg, int qubit1, int qubit2, qreal prob)</div><div class="ttdoc">Mixes a density matrix qureg to induce two-qubit dephasing noise.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01011">QuEST.c:1011</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaa3fb996a5cadd098f4acd8aec955cf9c"><div class="ttname"><a href="group__unitary.html#gaa3fb996a5cadd098f4acd8aec955cf9c">controlledUnitary</a></div><div class="ttdeci">void controlledUnitary(Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general controlled unitary (single control, single target), which can include a global phase ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00361">QuEST.c:361</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ac2eb81c71d0e0fbec7be5b45b1db1448"><div class="ttname"><a href="QuEST__common_8c.html#ac2eb81c71d0e0fbec7be5b45b1db1448">statevec_measureWithStats</a></div><div class="ttdeci">int statevec_measureWithStats(Qureg qureg, int measureQubit, qreal *outcomeProb)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00361">QuEST_common.c:361</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a7c8491926b4c7b4bf8e8123f4464a08e"><div class="ttname"><a href="QuEST__validation_8c.html#a7c8491926b4c7b4bf8e8123f4464a08e">validateNumQubitsInMatrix</a></div><div class="ttdeci">void validateNumQubitsInMatrix(int numQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00325">QuEST_validation.c:325</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ad9fd3017ea40cf63fd04b39e03494972"><div class="ttname"><a href="QuEST__internal_8h.html#ad9fd3017ea40cf63fd04b39e03494972">statevec_initDebugState</a></div><div class="ttdeci">void statevec_initDebugState(Qureg qureg)</div><div class="ttdoc">Initialise the state vector of probability amplitudes to an (unphysical) state with each component of...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01591">QuEST_cpu.c:1591</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html_afde13e469a3b4f179f45e53d1ec0a7cf"><div class="ttname"><a href="structComplexMatrixN.html#afde13e469a3b4f179f45e53d1ec0a7cf">ComplexMatrixN::imag</a></div><div class="ttdeci">qreal ** imag</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00140">QuEST.h:140</a></div></div>
<div class="ttc" id="agroup__type_html_ga12a6c59ebbfba8bdb9453a4138027d46"><div class="ttname"><a href="group__type.html#ga12a6c59ebbfba8bdb9453a4138027d46">initDiagonalOp</a></div><div class="ttdeci">void initDiagonalOp(DiagonalOp op, qreal *real, qreal *imag)</div><div class="ttdoc">Updates the entire DiagonalOp op with the given elements, of which there must be 2^op....</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01286">QuEST.c:1286</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abb2eab4af99adcc59be24f4c91c6f6ad"><div class="ttname"><a href="QuEST__internal_8h.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a></div><div class="ttdeci">void statevec_controlledNot(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01061">QuEST_cpu_distributed.c:1061</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga26baa057f5db8804825c2d611386753b"><div class="ttname"><a href="group__unitary.html#ga26baa057f5db8804825c2d611386753b">phaseShift</a></div><div class="ttdeci">void phaseShift(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdoc">Shift the phase between  and  of a single qubit by a given angle.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00488">QuEST.c:488</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a066b0c4d0b02a0f3b9be7e5c68d9de6a"><div class="ttname"><a href="QuEST__validation_8c.html#a066b0c4d0b02a0f3b9be7e5c68d9de6a">validatePauliHamil</a></div><div class="ttdeci">void validatePauliHamil(PauliHamil hamil, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00619">QuEST_validation.c:619</a></div></div>
<div class="ttc" id="aQuEST__precision_8h_html"><div class="ttname"><a href="QuEST__precision_8h.html">QuEST_precision.h</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a654db9d60abdcae26427e7d3b3d9c432"><div class="ttname"><a href="QuEST__validation_8c.html#a654db9d60abdcae26427e7d3b3d9c432">validateTwoQubitUnitaryMatrix</a></div><div class="ttdeci">void validateTwoQubitUnitaryMatrix(Qureg qureg, ComplexMatrix4 u, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00445">QuEST_validation.c:445</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_aa32eed5bc38e85193e1aa23b74e8541b"><div class="ttname"><a href="QuEST__common_8c.html#aa32eed5bc38e85193e1aa23b74e8541b">statevec_controlledRotateX</a></div><div class="ttdeci">void statevec_controlledRotateX(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00343">QuEST_common.c:343</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_ac5bd32bc24176e616a288ae04752fc9c"><div class="ttname"><a href="QuEST__validation_8c.html#ac5bd32bc24176e616a288ae04752fc9c">validateDiagOpInit</a></div><div class="ttdeci">void validateDiagOpInit(DiagonalOp op, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00673">QuEST_validation.c:673</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaa5a138473a4433c853c6e66e7aabc237"><div class="ttname"><a href="group__unitary.html#gaa5a138473a4433c853c6e66e7aabc237">controlledNot</a></div><div class="ttdeci">void controlledNot(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdoc">Apply the controlled not (single control, single target) gate, also known as the c-X,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00525">QuEST.c:525</a></div></div>
<div class="ttc" id="agroup__calc_html_ga8cbe422d4981bf06847d229a4c6aa3df"><div class="ttname"><a href="group__calc.html#ga8cbe422d4981bf06847d229a4c6aa3df">getNumAmps</a></div><div class="ttdeci">long long int getNumAmps(Qureg qureg)</div><div class="ttdoc">Get the number of probability amplitudes in a qureg object, given by 2^numQubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00672">QuEST.c:672</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aa6c3f86010ad398f42b0577ea3bb5bcf"><div class="ttname"><a href="QuEST__internal_8h.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a></div><div class="ttdeci">qreal densmatr_calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00415">QuEST_cpu_distributed.c:415</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a288dc4b46bdacd69cbf4a6fd070d26a7"><div class="ttname"><a href="QuEST__internal_8h.html#a288dc4b46bdacd69cbf4a6fd070d26a7">statevec_initClassicalState</a></div><div class="ttdeci">void statevec_initClassicalState(Qureg qureg, long long int stateInd)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01470">QuEST_cpu.c:1470</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a2b88b068a8242ee28da42c7324cdd078"><div class="ttname"><a href="QuEST__validation_8c.html#a2b88b068a8242ee28da42c7324cdd078">validateMatchingQuregPauliHamilDims</a></div><div class="ttdeci">void validateMatchingQuregPauliHamilDims(Qureg qureg, PauliHamil hamil, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00624">QuEST_validation.c:624</a></div></div>
<div class="ttc" id="astructQureg_html_acf78445e9435d09f44f0cc832c6aee79"><div class="ttname"><a href="structQureg.html#acf78445e9435d09f44f0cc832c6aee79">Qureg::isDensityMatrix</a></div><div class="ttdeci">int isDensityMatrix</div><div class="ttdoc">Whether this instance is a density-state representation.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00206">QuEST.h:206</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_af3fc7bd149c70f083b149050242cd55e"><div class="ttname"><a href="QuEST__internal_8h.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a></div><div class="ttdeci">void statevec_hadamard(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01206">QuEST_cpu_distributed.c:1206</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a1f0db2800d13b6c2b120e05129cd13cb"><div class="ttname"><a href="QuEST__common_8c.html#a1f0db2800d13b6c2b120e05129cd13cb">statevec_rotateY</a></div><div class="ttdeci">void statevec_rotateY(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00299">QuEST_common.c:299</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a031812e1cf2c98d72d795cea7bbe73a5"><div class="ttname"><a href="QuEST__validation_8c.html#a031812e1cf2c98d72d795cea7bbe73a5">validateMatchingQuregTypes</a></div><div class="ttdeci">void validateMatchingQuregTypes(Qureg qureg1, Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00499">QuEST_validation.c:499</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html_a606f7afbc3f65a596bdca21cb43be6a8"><div class="ttname"><a href="structComplexMatrixN.html#a606f7afbc3f65a596bdca21cb43be6a8">ComplexMatrixN::numQubits</a></div><div class="ttdeci">int numQubits</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00138">QuEST.h:138</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5f87419b253a97f6caadb72b507b9853"><div class="ttname"><a href="QuEST__validation_8c.html#a5f87419b253a97f6caadb72b507b9853">validateAmpIndex</a></div><div class="ttdeci">void validateAmpIndex(Qureg qureg, long long int ampInd, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00346">QuEST_validation.c:346</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga4193c14cfb918fa3291fb0648058d63e"><div class="ttname"><a href="group__unitary.html#ga4193c14cfb918fa3291fb0648058d63e">pauliX</a></div><div class="ttdeci">void pauliX(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit Pauli-X (also known as the X, sigma-X, NOT or bit-flip) gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00433">QuEST.c:433</a></div></div>
<div class="ttc" id="agroup__type_html_gabd07eee133dcd4e6ae7c2d2ce4c42978"><div class="ttname"><a href="group__type.html#gabd07eee133dcd4e6ae7c2d2ce4c42978">createCloneQureg</a></div><div class="ttdeci">Qureg createCloneQureg(Qureg qureg, QuESTEnv env)</div><div class="ttdoc">Create a new Qureg which is an exact clone of the passed qureg, which can be either a statevector or ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00064">QuEST.c:64</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a600bda10463e2078ce746ec28f2d39c9"><div class="ttname"><a href="QuEST__internal_8h.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a></div><div class="ttdeci">void statevec_multiControlledUnitary(Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00997">QuEST_cpu_distributed.c:997</a></div></div>
<div class="ttc" id="agroup__calc_html_ga50ee589fd5ceab52fdd70d0082352b41"><div class="ttname"><a href="group__calc.html#ga50ee589fd5ceab52fdd70d0082352b41">calcExpecPauliSum</a></div><div class="ttdeci">qreal calcExpecPauliSum(Qureg qureg, enum pauliOpType *allPauliCodes, qreal *termCoeffs, int numSumTerms, Qureg workspace)</div><div class="ttdoc">Computes the expected value of a sum of products of Pauli operators.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00961">QuEST.c:961</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a05756b45f10135bb2eeb07380f806c20"><div class="ttname"><a href="QuEST__internal_8h.html#a05756b45f10135bb2eeb07380f806c20">statevec_initStateFromSingleFile</a></div><div class="ttdeci">int statevec_initStateFromSingleFile(Qureg *qureg, char filename[200], QuESTEnv env)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01625">QuEST_cpu.c:1625</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a73bb5e6a5dcfba274ce93355d4a04db4"><div class="ttname"><a href="QuEST__validation_8c.html#a73bb5e6a5dcfba274ce93355d4a04db4">validateHamilFileParams</a></div><div class="ttdeci">void validateHamilFileParams(int numQubits, int numTerms, FILE *file, char *fn, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00628">QuEST_validation.c:628</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a0344fbbb2bb505f7db14b420153f1eb5"><div class="ttname"><a href="QuEST__validation_8c.html#a0344fbbb2bb505f7db14b420153f1eb5">validateOneQubitUnitaryMatrix</a></div><div class="ttdeci">void validateOneQubitUnitaryMatrix(ComplexMatrix2 u, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00441">QuEST_validation.c:441</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga3d89916b46bc4aaf23e938022e6c89c1"><div class="ttname"><a href="group__unitary.html#ga3d89916b46bc4aaf23e938022e6c89c1">controlledTwoQubitUnitary</a></div><div class="ttdeci">void controlledTwoQubitUnitary(Qureg qureg, int controlQubit, int targetQubit1, int targetQubit2, ComplexMatrix4 u)</div><div class="ttdoc">Apply a general controlled two-qubit unitary (including a global phase factor).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00270">QuEST.c:270</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a7adc86571f1154558676d95daf0cbd1f"><div class="ttname"><a href="QuEST__validation_8c.html#a7adc86571f1154558676d95daf0cbd1f">validateSecondQuregStateVec</a></div><div class="ttdeci">void validateSecondQuregStateVec(Qureg qureg2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00503">QuEST_validation.c:503</a></div></div>
<div class="ttc" id="astructPauliHamil_html_acb49fff0e3160ea1904c9ca34408b4e1"><div class="ttname"><a href="structPauliHamil.html#acb49fff0e3160ea1904c9ca34408b4e1">PauliHamil::numQubits</a></div><div class="ttdeci">int numQubits</div><div class="ttdoc">The number of qubits for which this Hamiltonian is defined.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00168">QuEST.h:168</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a33cde9b6518d55a544eff20301a5d844"><div class="ttname"><a href="QuEST__common_8c.html#a33cde9b6518d55a544eff20301a5d844">statevec_sqrtSwapGateConj</a></div><div class="ttdeci">void statevec_sqrtSwapGateConj(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00397">QuEST_common.c:397</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a3e11a9b9fa5ee16d4738a97f4590ee61"><div class="ttname"><a href="QuEST__common_8c.html#a3e11a9b9fa5ee16d4738a97f4590ee61">statevec_controlledRotateZ</a></div><div class="ttdeci">void statevec_controlledRotateZ(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00355">QuEST_common.c:355</a></div></div>
<div class="ttc" id="astructQureg_html_ad08dff5316b8937f4b2a1417591543dc"><div class="ttname"><a href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">Qureg::numQubitsRepresented</a></div><div class="ttdeci">int numQubitsRepresented</div><div class="ttdoc">The number of qubits represented in either the state-vector or density matrix.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00208">QuEST.h:208</a></div></div>
<div class="ttc" id="aQuEST__validation_8h_html"><div class="ttname"><a href="QuEST__validation_8h.html">QuEST_validation.h</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1c82b5e914a8a39c5c7b782dbc16fa76"><div class="ttname"><a href="QuEST__internal_8h.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a></div><div class="ttdeci">void statevec_pauliX(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01034">QuEST_cpu_distributed.c:1034</a></div></div>
<div class="ttc" id="astructQureg_html_adef4935cac95763c29164cf99b144ed4"><div class="ttname"><a href="structQureg.html#adef4935cac95763c29164cf99b144ed4">Qureg::numAmpsTotal</a></div><div class="ttdeci">long long int numAmpsTotal</div><div class="ttdoc">Total number of amplitudes, which are possibly distributed among machines.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00215">QuEST.h:215</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5b0392701c555a898403f80ef4a32f62"><div class="ttname"><a href="QuEST__validation_8c.html#a5b0392701c555a898403f80ef4a32f62">validateMultiControlsMultiTargets</a></div><div class="ttdeci">void validateMultiControlsMultiTargets(Qureg qureg, int *controlQubits, int numControlQubits, int *targetQubits, int numTargetQubits, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00423">QuEST_validation.c:423</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fa5053f3d968443bc04e8b1d09f18bab9a">GATE_S</a></div><div class="ttdeci">@ GATE_S</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00025">QuEST_qasm.h:25</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fab12d052de2b7c59c6ab87710fd7d3c78">GATE_SWAP</a></div><div class="ttdeci">@ GATE_SWAP</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00033">QuEST_qasm.h:33</a></div></div>
<div class="ttc" id="astructComplex_html_ab5b2e2eca02131fc74b289a83636cbe3"><div class="ttname"><a href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">Complex::real</a></div><div class="ttdeci">qreal real</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00105">QuEST.h:105</a></div></div>
<div class="ttc" id="agroup__decoherence_html_ga97d563fa8f4bc51f720bbb653f5480b3"><div class="ttname"><a href="group__decoherence.html#ga97d563fa8f4bc51f720bbb653f5480b3">mixDensityMatrix</a></div><div class="ttdeci">void mixDensityMatrix(Qureg combineQureg, qreal otherProb, Qureg otherQureg)</div><div class="ttdoc">Modifies combineQureg to become (1-prob)combineProb + prob otherQureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00772">QuEST.c:772</a></div></div>
<div class="ttc" id="agroup__type_html_ga3392816c0643414165c2f5caeec17df0"><div class="ttname"><a href="group__type.html#ga3392816c0643414165c2f5caeec17df0">createQureg</a></div><div class="ttdeci">Qureg createQureg(int numQubits, QuESTEnv env)</div><div class="ttdoc">Create a Qureg object representing a set of qubits which will remain in a pure state.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00036">QuEST.c:36</a></div></div>
<div class="ttc" id="agroup__type_html_gac1c8ed909b33bd55ae680901006051b6"><div class="ttname"><a href="group__type.html#gac1c8ed909b33bd55ae680901006051b6">destroyPauliHamil</a></div><div class="ttdeci">void destroyPauliHamil(PauliHamil h)</div><div class="ttdoc">Destroy a PauliHamil instance, created with either createPauliHamil() or createPauliHamilFromFile().</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01163">QuEST.c:1163</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a63bf6575f12d7113fb854a2b6cc1a756"><div class="ttname"><a href="QuEST__common_8c.html#a63bf6575f12d7113fb854a2b6cc1a756">densmatr_mixPauli</a></div><div class="ttdeci">void densmatr_mixPauli(Qureg qureg, int qubit, qreal probX, qreal probY, qreal probZ)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00676">QuEST_common.c:676</a></div></div>
<div class="ttc" id="agroup__unitary_html_gac15907193da5a7c48b9610a26e669064"><div class="ttname"><a href="group__unitary.html#gac15907193da5a7c48b9610a26e669064">tGate</a></div><div class="ttdeci">void tGate(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit T gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00477">QuEST.c:477</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga3250d0d95b5d755cad542a6a2372b894"><div class="ttname"><a href="group__unitary.html#ga3250d0d95b5d755cad542a6a2372b894">multiRotateZ</a></div><div class="ttdeci">void multiRotateZ(Qureg qureg, int *qubits, int numQubits, qreal angle)</div><div class="ttdoc">Apply a multi-qubit Z rotation on a selected number of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00626">QuEST.c:626</a></div></div>
<div class="ttc" id="astructComplex_html_a84f5439aad0ef495efdd3b4c1c02d27e"><div class="ttname"><a href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">Complex::imag</a></div><div class="ttdeci">qreal imag</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00106">QuEST.h:106</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ab58d6d599c7a729255b1f8eeded663f3"><div class="ttname"><a href="QuEST__internal_8h.html#ab58d6d599c7a729255b1f8eeded663f3">agnostic_setDiagonalOpElems</a></div><div class="ttdeci">void agnostic_setDiagonalOpElems(DiagonalOp op, long long int startInd, qreal *real, qreal *imag, long long int numElems)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03842">QuEST_cpu.c:3842</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aaf78491e35d165edfd57387f9fffecbd"><div class="ttname"><a href="QuEST__internal_8h.html#aaf78491e35d165edfd57387f9fffecbd">statevec_controlledPhaseFlip</a></div><div class="ttdeci">void statevec_controlledPhaseFlip(Qureg qureg, int idQubit1, int idQubit2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03300">QuEST_cpu.c:3300</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a38738db33da795b9d52bace2d9fbe7ee"><div class="ttname"><a href="QuEST__validation_8c.html#a38738db33da795b9d52bace2d9fbe7ee">validateMultiQubitKrausMap</a></div><div class="ttdeci">void validateMultiQubitKrausMap(Qureg qureg, int numTargs, ComplexMatrixN *ops, int numOps, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00598">QuEST_validation.c:598</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a576519ac36b7cb25bab78d05b5d1975f"><div class="ttname"><a href="QuEST__validation_8c.html#a576519ac36b7cb25bab78d05b5d1975f">validateMultiQubitMatrix</a></div><div class="ttdeci">void validateMultiQubitMatrix(Qureg qureg, ComplexMatrixN u, int numTargs, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00460">QuEST_validation.c:460</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a7891142f169db6d440a4145501cd1d4c"><div class="ttname"><a href="QuEST__validation_8c.html#a7891142f169db6d440a4145501cd1d4c">validateNumQubitsInDiagOp</a></div><div class="ttdeci">void validateNumQubitsInDiagOp(int numQubits, int numRanks, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00329">QuEST_validation.c:329</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725faa29b98cbb581abf5ec338a1763de7a1b">GATE_SIGMA_Y</a></div><div class="ttdeci">@ GATE_SIGMA_Y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00022">QuEST_qasm.h:22</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a518c4351d574aea8477019dbce02f09c"><div class="ttname"><a href="QuEST__qasm_8c.html#a518c4351d574aea8477019dbce02f09c">qasm_recordCompactUnitary</a></div><div class="ttdeci">void qasm_recordCompactUnitary(Qureg qureg, Complex alpha, Complex beta, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00195">QuEST_qasm.c:195</a></div></div>
<div class="ttc" id="agroup__decoherence_html_ga9a77f84e1aa7d25d036b14d7d0cd8b61"><div class="ttname"><a href="group__decoherence.html#ga9a77f84e1aa7d25d036b14d7d0cd8b61">mixPauli</a></div><div class="ttdeci">void mixPauli(Qureg qureg, int qubit, qreal probX, qreal probY, qreal probZ)</div><div class="ttdoc">Mixes a density matrix qureg to induce general single-qubit Pauli noise.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01054">QuEST.c:1054</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ac8ea84dd85eca525daeeb30b3c96b673"><div class="ttname"><a href="QuEST__common_8c.html#ac8ea84dd85eca525daeeb30b3c96b673">ensureIndsIncrease</a></div><div class="ttdeci">void ensureIndsIncrease(int *ind1, int *ind2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00064">QuEST_common.c:64</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a8c9da88f734b0862f4cce7d819e6d3b5"><div class="ttname"><a href="QuEST__internal_8h.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a></div><div class="ttdeci">qreal densmatr_calcHilbertSchmidtDistance(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00430">QuEST_cpu_distributed.c:430</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae6cecbad32a03416138b321cdc1a2c33"><div class="ttname"><a href="QuEST__internal_8h.html#ae6cecbad32a03416138b321cdc1a2c33">statevec_compareStates</a></div><div class="ttdeci">int statevec_compareStates(Qureg mq1, Qureg mq2, qreal precision)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01675">QuEST_cpu.c:1675</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a5e99d405002cdf6ddd40922911d058a4"><div class="ttname"><a href="QuEST__qasm_8c.html#a5e99d405002cdf6ddd40922911d058a4">qasm_recordControlledUnitary</a></div><div class="ttdeci">void qasm_recordControlledUnitary(Qureg qureg, ComplexMatrix2 u, int controlQubit, int targetQubit)</div><div class="ttdoc">additionally performs Rz on target to restore the global phase lost from u in QASM U(a,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00278">QuEST_qasm.c:278</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga6532decd6c404189915563492f090e6f"><div class="ttname"><a href="group__unitary.html#ga6532decd6c404189915563492f090e6f">hadamard</a></div><div class="ttdeci">void hadamard(Qureg qureg, int targetQubit)</div><div class="ttdoc">Apply the single-qubit Hadamard gate.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00177">QuEST.c:177</a></div></div>
<div class="ttc" id="astructComplex_html"><div class="ttname"><a href="structComplex.html">Complex</a></div><div class="ttdoc">Represents one complex number.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00103">QuEST.h:103</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ade67874c89179541f616b3685595d3ae"><div class="ttname"><a href="QuEST__common_8c.html#ade67874c89179541f616b3685595d3ae">statevec_controlledRotateY</a></div><div class="ttdeci">void statevec_controlledRotateY(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00349">QuEST_common.c:349</a></div></div>
<div class="ttc" id="agroup__operator_html_gadfb5c1d99a22ce666fc715a8da2e0950"><div class="ttname"><a href="group__operator.html#gadfb5c1d99a22ce666fc715a8da2e0950">applyMatrix2</a></div><div class="ttdeci">void applyMatrix2(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general 2-by-2 matrix, which may be non-unitary.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00844">QuEST.c:844</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a5ea2384a9b33c94eac891aacbfa5da6a"><div class="ttname"><a href="QuEST__common_8c.html#a5ea2384a9b33c94eac891aacbfa5da6a">statevec_controlledRotateAroundAxisConj</a></div><div class="ttdeci">void statevec_controlledRotateAroundAxisConj(Qureg qureg, int controlQubit, int targetQubit, qreal angle, Vector axis)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00334">QuEST_common.c:334</a></div></div>
<div class="ttc" id="agroup__unitary_html_gab23a8b022ec83b9d423961ca87cd8cb5"><div class="ttname"><a href="group__unitary.html#gab23a8b022ec83b9d423961ca87cd8cb5">rotateZ</a></div><div class="ttdeci">void rotateZ(Qureg qureg, int targetQubit, qreal angle)</div><div class="ttdoc">Rotate a single qubit by a given angle around the Z-axis of the Bloch-sphere (also known as a phase s...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00210">QuEST.c:210</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaa700dc9657ade4cf16f1cad1624c5332"><div class="ttname"><a href="group__unitary.html#gaa700dc9657ade4cf16f1cad1624c5332">multiControlledUnitary</a></div><div class="ttdeci">void multiControlledUnitary(Qureg qureg, int *controlQubits, int numControlQubits, int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general multiple-control single-target unitary, which can include a global phase factor.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00374">QuEST.c:374</a></div></div>
<div class="ttc" id="agroup__init_html_ga2f049055d4a51d0ea4d1a43b5234dedb"><div class="ttname"><a href="group__init.html#ga2f049055d4a51d0ea4d1a43b5234dedb">initZeroState</a></div><div class="ttdeci">void initZeroState(Qureg qureg)</div><div class="ttdoc">Initialise a set of  qubits to the classical zero state .</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00113">QuEST.c:113</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a82b142fe77ba20c87142274f32e57689"><div class="ttname"><a href="QuEST__validation_8c.html#a82b142fe77ba20c87142274f32e57689">validateTrotterParams</a></div><div class="ttdeci">void validateTrotterParams(int order, int reps, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00667">QuEST_validation.c:667</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_aa5f05644a6cea13e00f828658bcf7a68"><div class="ttname"><a href="QuEST__qasm_8c.html#aa5f05644a6cea13e00f828658bcf7a68">qasm_setup</a></div><div class="ttdeci">void qasm_setup(Qureg *qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00060">QuEST_qasm.c:60</a></div></div>
<div class="ttc" id="aQuEST__qasm_8c_html_a81749d23b8c3c1acf87c9db675872c24"><div class="ttname"><a href="QuEST__qasm_8c.html#a81749d23b8c3c1acf87c9db675872c24">qasm_recordGate</a></div><div class="ttdeci">void qasm_recordGate(Qureg qureg, TargetGate gate, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8c_source.html#l00178">QuEST_qasm.c:178</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aa194ba5f5c6e19c6caa4c715b3dbefcc"><div class="ttname"><a href="QuEST__validation_8c.html#aa194ba5f5c6e19c6caa4c715b3dbefcc">validatePauliCodes</a></div><div class="ttdeci">void validatePauliCodes(enum pauliOpType *pauliCodes, int numPauliCodes, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00563">QuEST_validation.c:563</a></div></div>
<div class="ttc" id="agroup__calc_html_ga658b3a5cab5e73a17a7fd76a83583a22"><div class="ttname"><a href="group__calc.html#ga658b3a5cab5e73a17a7fd76a83583a22">calcDensityInnerProduct</a></div><div class="ttdeci">qreal calcDensityInnerProduct(Qureg rho1, Qureg rho2)</div><div class="ttdoc">Computes the Hilbert-Schmidt scalar product (which is equivalent to the Frobenius inner product of ma...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00918">QuEST.c:918</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a365bbb1b80cb00405c8bf1a4fa1ea8e5"><div class="ttname"><a href="QuEST__internal_8h.html#a365bbb1b80cb00405c8bf1a4fa1ea8e5">statevec_createQureg</a></div><div class="ttdeci">void statevec_createQureg(Qureg *qureg, int numQubits, QuESTEnv env)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01279">QuEST_cpu.c:1279</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae37b3eff5d3affbc1edfe216cabc1c53"><div class="ttname"><a href="QuEST__internal_8h.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a></div><div class="ttdeci">qreal densmatr_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01276">QuEST_cpu_distributed.c:1276</a></div></div>
<div class="ttc" id="agroup__type_html_ga93e55b6650b408abb30a1d4a8bce757c"><div class="ttname"><a href="group__type.html#ga93e55b6650b408abb30a1d4a8bce757c">createDensityQureg</a></div><div class="ttdeci">Qureg createDensityQureg(int numQubits, QuESTEnv env)</div><div class="ttdoc">Create a Qureg for qubits which are represented by a density matrix, and can be in mixed states.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00050">QuEST.c:50</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a5d49d4aadea858794b139c6a195ffd8b"><div class="ttname"><a href="QuEST__validation_8c.html#a5d49d4aadea858794b139c6a195ffd8b">validateUnitaryComplexPair</a></div><div class="ttdeci">void validateUnitaryComplexPair(Complex alpha, Complex beta, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00471">QuEST_validation.c:471</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html_a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689"><div class="ttname"><a href="QuEST__qasm_8h.html#a32bbd0276b80668812ac248cd81c725fae1267d5de573dc2901aa8e724ac1d689">GATE_ROTATE_Y</a></div><div class="ttdeci">@ GATE_ROTATE_Y</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__qasm_8h_source.html#l00028">QuEST_qasm.h:28</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2b2b8c69566a49cdf4a3fa2cb4f5e03c"><div class="ttname"><a href="QuEST__common_8c.html#a2b2b8c69566a49cdf4a3fa2cb4f5e03c">statevec_rotateZ</a></div><div class="ttdeci">void statevec_rotateZ(Qureg qureg, int rotQubit, qreal angle)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00305">QuEST_common.c:305</a></div></div>
<div class="ttc" id="agroup__operator_html_ga35b6321c578a8c69470132b5ee95f930"><div class="ttname"><a href="group__operator.html#ga35b6321c578a8c69470132b5ee95f930">applyTrotterCircuit</a></div><div class="ttdeci">void applyTrotterCircuit(Qureg qureg, PauliHamil hamil, qreal time, int order, int reps)</div><div class="ttdoc">Applies a trotterisation of unitary evolution  to qureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00830">QuEST.c:830</a></div></div>
<div class="ttc" id="agroup__type_html_ga35b28710877c462927366fa602e591cb"><div class="ttname"><a href="group__type.html#ga35b28710877c462927366fa602e591cb">createPauliHamil</a></div><div class="ttdeci">PauliHamil createPauliHamil(int numQubits, int numSumTerms)</div><div class="ttdoc">Create a PauliHamil instance, which is a Hamiltonian expressed as a real-weighted sum of products of ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01147">QuEST.c:1147</a></div></div>
<div class="ttc" id="agroup__init_html_ga234bd34016f08288532791903b9884b5"><div class="ttname"><a href="group__init.html#ga234bd34016f08288532791903b9884b5">initPlusState</a></div><div class="ttdeci">void initPlusState(Qureg qureg)</div><div class="ttdoc">Initialise a set of  qubits to the plus state  (and similarly  for density matrices).</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00125">QuEST.c:125</a></div></div>
<div class="ttc" id="agroup__calc_html_ga15cfad3f3d26339128e3be32ae7deacd"><div class="ttname"><a href="group__calc.html#ga15cfad3f3d26339128e3be32ae7deacd">calcExpecPauliProd</a></div><div class="ttdeci">qreal calcExpecPauliProd(Qureg qureg, int *targetQubits, enum pauliOpType *pauliCodes, int numTargets, Qureg workspace)</div><div class="ttdoc">Computes the expected value of a product of Pauli operators.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00952">QuEST.c:952</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a260639d187d09cbeef3ff36f0d4d1f0e"><div class="ttname"><a href="QuEST__validation_8c.html#a260639d187d09cbeef3ff36f0d4d1f0e">validateOneQubitDampingProb</a></div><div class="ttdeci">void validateOneQubitDampingProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00542">QuEST_validation.c:542</a></div></div>
<div class="ttc" id="agroup__unitary_html_gaf7e15bf09c64082e0a8467998eb25623"><div class="ttname"><a href="group__unitary.html#gaf7e15bf09c64082e0a8467998eb25623">controlledCompactUnitary</a></div><div class="ttdeci">void controlledCompactUnitary(Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdoc">Apply a controlled unitary (single control, single target) parameterised by two given complex scalars...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00418">QuEST.c:418</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga41b946a82982c3fa3dc2a7395665bc90"><div class="ttname"><a href="group__unitary.html#ga41b946a82982c3fa3dc2a7395665bc90">multiStateControlledUnitary</a></div><div class="ttdeci">void multiStateControlledUnitary(Qureg qureg, int *controlQubits, int *controlState, int numControlQubits, int targetQubit, ComplexMatrix2 u)</div><div class="ttdoc">Apply a general multiple-control, conditioned on a specific bit sequence, single-target unitary,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00389">QuEST.c:389</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a1275d604674224d87a173fb5bac78835"><div class="ttname"><a href="QuEST__internal_8h.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a></div><div class="ttdeci">void statevec_controlledCompactUnitary(Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00920">QuEST_cpu_distributed.c:920</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_abc9a9ef4344c7faaaf28ac25c76649b9"><div class="ttname"><a href="QuEST__internal_8h.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a></div><div class="ttdeci">qreal statevec_getRealAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00198">QuEST_cpu_distributed.c:198</a></div></div>
<div class="ttc" id="agroup__unitary_html_ga75d5e65f87c68403602a669b9c6d52b0"><div class="ttname"><a href="group__unitary.html#ga75d5e65f87c68403602a669b9c6d52b0">sqrtSwapGate</a></div><div class="ttdeci">void sqrtSwapGate(Qureg qureg, int qb1, int qb2)</div><div class="ttdoc">Performs a sqrt SWAP gate between qubit1 and qubit2.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00613">QuEST.c:613</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_aed5f85789dc4fa43b64e99e6b538035c"><div class="ttname"><a href="QuEST__validation_8c.html#aed5f85789dc4fa43b64e99e6b538035c">validateUniqueTargets</a></div><div class="ttdeci">void validateUniqueTargets(Qureg qureg, int qubit1, int qubit2, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00378">QuEST_validation.c:378</a></div></div>
<div class="ttc" id="agroup__decoherence_html_ga65b4c0944090fae78a37ba3b94811ace"><div class="ttname"><a href="group__decoherence.html#ga65b4c0944090fae78a37ba3b94811ace">mixMultiQubitKrausMap</a></div><div class="ttdeci">void mixMultiQubitKrausMap(Qureg qureg, int *targets, int numTargets, ComplexMatrixN *ops, int numOps)</div><div class="ttdoc">Apply a general N-qubit Kraus map to a density matrix, as specified by at most (2N)^2 Kraus operators...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01085">QuEST.c:1085</a></div></div>
<div class="ttc" id="aQuEST__qasm_8h_html"><div class="ttname"><a href="QuEST__qasm_8h.html">QuEST_qasm.h</a></div></div>
<div class="ttc" id="agroup__qasm_html_gacf139d0a54b1f9e5c2f2feff742b8c76"><div class="ttname"><a href="group__qasm.html#gacf139d0a54b1f9e5c2f2feff742b8c76">printRecordedQASM</a></div><div class="ttdeci">void printRecordedQASM(Qureg qureg)</div><div class="ttdoc">Print recorded QASM to stdout.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00099">QuEST.c:99</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a81fbd2eccd0d0e5a3cece4df2f96cb92"><div class="ttname"><a href="QuEST__internal_8h.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a></div><div class="ttdeci">void statevec_pauliYConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01115">QuEST_cpu_distributed.c:1115</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a2f58e35b04edfbc053e0c9ae19f1be97"><div class="ttname"><a href="QuEST__validation_8c.html#a2f58e35b04edfbc053e0c9ae19f1be97">validateTwoQubitDephaseProb</a></div><div class="ttdeci">void validateTwoQubitDephaseProb(qreal prob, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00532">QuEST_validation.c:532</a></div></div>
<div class="ttc" id="agroup__debug_html_gaa33ed720560d051eb4126b4a534bc4c6"><div class="ttname"><a href="group__debug.html#gaa33ed720560d051eb4126b4a534bc4c6">reportStateToScreen</a></div><div class="ttdeci">void reportStateToScreen(Qureg qureg, QuESTEnv env, int reportRank)</div><div class="ttdoc">Print the current state vector of probability amplitudes for a set of qubits to standard out.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01324">QuEST.c:1324</a></div></div>
<div class="ttc" id="agroup__type_html_gaebf896dd8d5eeaf9fd896f6cc8e334fe"><div class="ttname"><a href="group__type.html#gaebf896dd8d5eeaf9fd896f6cc8e334fe">createDiagonalOp</a></div><div class="ttdeci">DiagonalOp createDiagonalOp(int numQubits, QuESTEnv env)</div><div class="ttdoc">Creates a DiagonalOp representing a diagonal operator on the full Hilbert space of a Qureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l01267">QuEST.c:1267</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_ae4ebc1f4dd48922bfb30ad1692310269"><div class="ttname"><a href="QuEST__common_8c.html#ae4ebc1f4dd48922bfb30ad1692310269">densmatr_measureWithStats</a></div><div class="ttdeci">int densmatr_measureWithStats(Qureg qureg, int measureQubit, qreal *outcomeProb)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00369">QuEST_common.c:369</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ad65ad1b5ea6f30b0c6b4ffda96e1a8e6"><div class="ttname"><a href="QuEST__internal_8h.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a></div><div class="ttdeci">qreal statevec_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00088">QuEST_cpu_distributed.c:88</a></div></div>
<div class="ttc" id="astructComplexMatrix2_html"><div class="ttname"><a href="structComplexMatrix2.html">ComplexMatrix2</a></div><div class="ttdoc">Represents a 2x2 matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00114">QuEST.h:114</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_ae5ad68d054875913d0f7ec654840a9ec"><div class="ttname"><a href="QuEST__internal_8h.html#ae5ad68d054875913d0f7ec654840a9ec">densmatr_initPureState</a></div><div class="ttdeci">void densmatr_initPureState(Qureg targetQureg, Qureg copyQureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l00452">QuEST_cpu_distributed.c:452</a></div></div>
<div class="ttc" id="aQuEST__validation_8c_html_a1b018a5766c1b26c731e8dcaa76abb19"><div class="ttname"><a href="QuEST__validation_8c.html#a1b018a5766c1b26c731e8dcaa76abb19">validateOneQubitPauliProbs</a></div><div class="ttdeci">void validateOneQubitPauliProbs(qreal probX, qreal probY, qreal probZ, const char *caller)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__validation_8c_source.html#l00552">QuEST_validation.c:552</a></div></div>
<div class="ttc" id="agroup__unitary_html_gafbbded98b7233f5da06d74d1db5cbfdb"><div class="ttname"><a href="group__unitary.html#gafbbded98b7233f5da06d74d1db5cbfdb">controlledRotateY</a></div><div class="ttdeci">void controlledRotateY(Qureg qureg, int controlQubit, int targetQubit, qreal angle)</div><div class="ttdoc">Applies a controlled rotation by a given angle around the Y-axis of the Bloch-sphere.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8c_source.html#l00233">QuEST.c:233</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_aedd7ecccf2f09dd2f1c5d191950b51e6"><div class="ttname"><a href="QuEST__internal_8h.html#aedd7ecccf2f09dd2f1c5d191950b51e6">densmatr_applyDiagonalOp</a></div><div class="ttdeci">void densmatr_applyDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__distributed_8c_source.html#l01517">QuEST_cpu_distributed.c:1517</a></div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
</body>
        <script type="text/javascript" src="boot.js"></script>
</html>
